firebase / flutterfire

๐Ÿ”ฅ A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.57k stars 3.94k forks source link

โ˜‚๏ธ Support for Background Isolates #10353

Open Lyokone opened 1 year ago

Lyokone commented 1 year ago

This umbrella issue describes the current support of Background Isolates (announced as of Flutter 3.7) with FlutterFire.

The current implementation of Background Isolates only supports Flutter->Host and not the other way around. It means plugins that need to communicate back to Flutter will not work yet with Background Isolates.

Current support:

๐Ÿšง cloud_firestore (works but some errors when hot reloading, no support for subscribing to documents) โœ… cloud_functions โ“ firebase_analytics โ“ firebase_app_check โ“ firebase_app_installations ๐Ÿšง firebase_auth (some functions not available - verifyPhone) โœ… firebase_core โ“ firebase_crashlytics ๐Ÿšง firebase_database (works but some errors when hot reloading, no support for subscribing to documents) โŒ firebase_dynamic_links โ“ firebase_in_app_messaging โ“ firebase_messaging โ“ firebase_ml_custom โ“ firebase_ml_model_downloader โ“ firebase_ml_vision โœ… firebase_performance โ“ firebase_remote_config โŒ firebase_storage

Legend:

โ“ = Not yet tested โœ… = Works ๐Ÿšง = Works partially โŒ = Doesn't work

ariefwijaya commented 1 year ago

How to know if it doesn;t work, is there any error occured?

Lyokone commented 1 year ago

@ariefwijaya Yes, if it doesn't work, you'll get an error.

ariefwijaya commented 1 year ago

Oh, sorry but I tried and firebase_storage worked in isolate. I use it to download file using await firebaseStorage.refFromURL(url).writeToFile(existFile); @Lyokone

Lyokone commented 1 year ago

@ariefwijaya Did you try with RootIsolateToken?

ariefwijaya commented 1 year ago

@Lyokone I'm using WorkManager to work in isolate

Lyokone commented 1 year ago

@ariefwijaya As pointed in the issue, this thread is for tracking support of Flutter own Background Isolates

timsauvageot commented 1 year ago

Is it planned to add documentation regarding available features to pub.dev of the packages or any other place? I couldn't find it anywhere in the official documentation and it's currently a process of trial and error to figure out what works in the background.

Lyokone commented 1 year ago

Currently, we rely on both ways communication. As long as Flutter will not provide communication from the host to Flutter, it will probably stay in this state.

timsauvageot commented 1 year ago

Currently, we rely on both ways communication. As long as Flutter will not provide communication from the host to Flutter, it will probably stay in this state.

I understand the underlying issue but this doesn't seem to be documented anywhere in the Flutter packages.