cloud_firestore_dart_flutterfire library

A bridge from the FlutterFire plugins (firebase_core, firebase_auth) to cloud_firestore_dart.

A Flutter app that initializes Firebase and signs its users in with the official plugins gets a cloud_firestore_dart instance for the same project and the same user, without copying the options and without a second sign-in:

await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
final FirebaseFirestore firestore = await FlutterFireBridge.firestore();

FlutterFireBridge does the common case. The pieces, for wiring by hand: firebaseOptionsFromFlutterFire and dartAppFor for the app, FlutterFireAuthTokenProvider for the user, and FlutterFireAppCheckProvider for App Check tokens.

firebase_core and firebase_app_dart both export Firebase, FirebaseApp, FirebaseOptions and FirebaseException: import one of them with a prefix.

Classes

FlutterFireAppCheckProvider
An App Check token provider for cloud_firestore_dart that takes the tokens from the official firebase_app_check plugin, or from any source with the same two members.
FlutterFireAuthTokenProvider
A token provider for cloud_firestore_dart that takes the user and the ID token from the official firebase_auth plugin.
FlutterFireBridge
The common case in one call: a cloud_firestore_dart instance for a FlutterFire app and its signed-in user.
IdTokenUser
What FlutterFireAuthTokenProvider needs of a signed-in user: the id and the ID token.

Functions

dartAppFor(String name, FirebaseOptions options, {PlatformDependencies? dependencies, AuthTokenProvider? authProvider, AppCheckTokenProvider? appCheckProvider}) → FirebaseApp
The firebase_app_dart app called name with the options of a FlutterFire app, created on the first call.
firebaseOptionsFromFlutterFire(FirebaseOptions options) → FirebaseOptions
The firebase_app_dart options for the FlutterFire options (of firebase_core).