Repository navigation
Conversation
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
…and scope Android task registries per engine - Dart: one internal subscription now drives `snapshot` and `onComplete`, and users get a separate broadcast stream. Cancelling the last `snapshotEvents` listener no longer cancels the native event stream (which cancelled the upload on Android) and `await task` no longer hangs afterwards. `onComplete` also fails instead of hanging when the native stream closes without a final state or the task fails to start. - Android: cancelling a task's event stream only stops sending events, as on iOS. In-progress tasks and event channels are tracked per plugin instance, so detaching a background engine no longer cancels the main engine's tasks or tears down its streams, and same-numbered handles from different engines no longer collide.
…the engine-detach upload - The listener-cancel e2e test now times out its `snapshotEvents.first` wait, like the rest of the file. - The engine-detach e2e test uploads 10 MB instead of 20 MB. On the Android emulator it is still uploading about 2 s after the second engine is destroyed, and it still fails on the old Android code. - The Android `onCancel` comment no longer claims parity with iOS. Android behaviour change (from this PR): disposing a `StreamBuilder`, a rebuild, or `await for ... break` no longer cancels the upload or download. The task keeps running until it ends or is cancelled by `task.cancel()`, as on iOS and web. A paused task the app forgets is kept for the life of the process.
de1d1c9 to
001a177
Compare
Description
Fixes two task bugs in
firebase_storage.1. Cancelling the last
snapshotEventslistener breaks the task.When the only listener goes away (
snapshotEvents.first, or a progress dialog'sStreamBuilderclosing), the native event stream is cancelled. On Android this also cancels the upload. On every native platform, a laterawait tasknever completes.Fix: the task keeps its own internal listener, so
await taskalways gets the final state. On Android, cancelling a listener only stops the events. If the native stream ends without a final state,await tasknow throws instead of hanging.2. On Android, all engines share one task list.
When a background engine (workmanager, for example) detaches, it cancels the main engine's uploads, and the main engine's
await taskhangs. Fix: each engine keeps its own tasks and event channels.Behaviour change (Android): disposing a
StreamBuilderno longer cancels the upload or download. Calltask.cancel()to stop it, as on iOS and web.Tests
method_channel_task_test.dart): cancelling the only listener keeps the native stream andonCompleteworking;onCompletethrows if the stream closes early or the task fails to start. These hang or fail onmain.FlutterFirebaseStorageTaskRegistryTest): two engines can use the same task handle without affecting each other.task_e2e.dart):await taskcompletes after its only listener is cancelled (all platforms), and detaching the plugin from a second engine doesn't stop this engine's upload (Android). Both time out onmain.Related Issues
Follow-up to #18240 / #18255, which only fixed the crash on detach.
Checklist
///).melos run analyze) does not report any problems on my PR.Breaking Change