FirebaseFirestore class
The entry point for accessing a FirebaseFirestore.
You can get an instance by calling FirebaseFirestore.instance. The instance can also be created with a secondary Firebase app by calling FirebaseFirestore.instanceFor, for example:
FirebaseApp secondaryApp = Firebase.app('SecondaryApp');
FirebaseFirestore firestore = FirebaseFirestore.instanceFor(app: secondaryApp);
- Inheritance
-
- Object
- FirebasePlugin
- FirebaseFirestore
Properties
- app ↔ FirebaseApp
-
The FirebaseApp for this current FirebaseFirestore instance.
getter/setter pair
- databaseId ↔ String
-
Firestore Database ID for this instance. Falls back to default database: "(default)"
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setteroverride
- pluginConstants → Map
-
Returns any plugin constants this plugin app instance has initialized.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- settings ↔ Settings
-
The current
Settingsfor this FirebaseFirestore instance.getter/setter pair
Methods
-
batch(
) → WriteBatch -
Returns a
WriteBatch, used for performing multiple writes as a single atomic operation. -
clearPersistence(
) → Future< void> - Clears the persistent storage, including pending writes and cached documents.
-
collection(
String collectionPath) → CollectionReference< Map< String, dynamic> > -
Gets a
CollectionReferencefor the specified Firestore path. -
collectionGroup(
String collectionPath) → Query< Map< String, dynamic> > -
Gets a
Queryfor the specified collection group. -
disableNetwork(
) → Future< void> - Instructs FirebaseFirestore to disable the network for the instance.
-
doc(
String documentPath) → DocumentReference< Map< String, dynamic> > -
Gets a
DocumentReferencefor the specified Firestore path. -
enableNetwork(
) → Future< void> - Enables the network for this instance. Any pending local-only writes will be written to the remote servers.
-
loadBundle(
Uint8List bundle) → LoadBundleTask -
namedQueryGet(
String name, {GetOptions options = const GetOptions()}) → Future< QuerySnapshot< Map< >String, dynamic> > -
Reads a
QuerySnapshotif a namedQuery has been retrieved and passed as aBufferto loadBundle(). To read from cache, passGetOptions.sourcevalue asSource.cache. To read from the Firestore backend, useGetOptions.sourceasSource.server. -
namedQueryWithConverterGet<
T> (String name, {GetOptions options = const GetOptions(), required FromFirestore< T> fromFirestore, required ToFirestore<T> toFirestore}) → Future<QuerySnapshot< T> > -
Performs a namedQueryGet and decode the result using
Query.withConverter. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
persistentCacheIndexManager(
) → PersistentCacheIndexManager? -
pipeline(
) → PipelineSource -
Returns a
PipelineSourcefor creating and executing pipelines. -
runTransaction<
T> (TransactionHandler< T> transactionHandler, {Duration timeout = const Duration(seconds: 30), int maxAttempts = 5}) → Future<T> -
Executes the given
TransactionHandlerand then attempts to commit the changes applied within an atomic transaction. -
setIndexConfigurationFromJSON(
String json) → Future< void> - Configures indexing for local query execution. Any previous index configuration is overridden.
-
snapshotsInSync(
) → Stream< void> - Returns a Stream which is called each time all of the active listeners have been synchronized.
-
terminate(
) → Future< void> - Terminates this FirebaseFirestore instance.
-
toString(
) → String -
A string representation of this object.
override
-
useFirestoreEmulator(
String host, int port, {bool sslEnabled = false, bool automaticHostMapping = true}) → void - Changes this instance to point to a FirebaseFirestore emulator running locally.
-
waitForPendingWrites(
) → Future< void> - Waits until all currently pending writes for the active user have been acknowledged by the backend.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Properties
- instance → FirebaseFirestore
-
Returns an instance using the default FirebaseApp.
no setter
Static Methods
-
instanceFor(
{required FirebaseApp app, String? databaseId}) → FirebaseFirestore - Returns an instance using a specified FirebaseApp.
-
setLoggingEnabled(
bool enabled) → Future< void> - Globally enables / disables Cloud Firestore logging for the SDK.