FirebaseDatabase class

The entry point for accessing a Firebase Database. You can get an instance by calling FirebaseDatabase.instance or FirebaseDatabase.instanceFor().

Inheritance
  • Object
  • PlatformInterface
  • FirebasePluginPlatform
  • FirebaseDatabase

Constructors

FirebaseDatabase({FirebaseApp? app, String? databaseURL})
Returns an instance of FirebaseDatabase with the given FirebaseApp and/or [databaseURL).
factory

Properties

app ↔ FirebaseApp
The FirebaseApp for this current FirebaseDatabase instance.
getter/setter pair
databaseURL String?
A custom Database URL for this instance.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
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

Methods

goOffline() Future<void>
Shuts down our connection to the Firebase Database backend until goOnline is called.
goOnline() Future<void>
Resumes our connection to the Firebase Database backend after a previous goOffline call.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
purgeOutstandingWrites() Future<void>
The Firebase Database client automatically queues writes and sends them to the server at the earliest opportunity, depending on network connectivity. In some cases (e.g. offline usage) there may be a large number of writes waiting to be sent. Calling this method will purge all outstanding writes so they are abandoned.
ref([String? path]) DatabaseReference
Returns a DatabaseReference representing the location in the Database corresponding to the provided path. If no path is provided, the Reference will point to the root of the Database.
reference() DatabaseReference
Returns a DatabaseReference accessing the root of the database.
refFromURL(String url) DatabaseReference
Returns a DatabaseReference representing the location in the Database corresponding to the provided Firebase URL.
setLoggingEnabled(bool enabled) → void
Enables verbose diagnostic logging for debugging your application. This must be called before any other usage of FirebaseDatabase instance. By default, diagnostic logging is disabled.
setPersistenceCacheSizeBytes(int cacheSize) → void
Attempts to set the size of the persistence cache.
setPersistenceEnabled(bool enabled) → void
Attempts to sets the database persistence to enabled.
toString() String
A string representation of this object.
inherited
useDatabaseEmulator(String host, int port, {bool automaticHostMapping = true}) → void
Changes this instance to point to a FirebaseDatabase emulator running locally.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance FirebaseDatabase
Returns an instance using the default FirebaseApp.
no setter

Static Methods

instanceFor({required FirebaseApp app, String? databaseURL}) FirebaseDatabase
Returns an instance using a specified FirebaseApp.