LoadBundleTask class

Represents the task of loading a Firestore bundle. It provides progress of bundle loading, as well as task completion and error events.

FirebaseFirestore.loadBundle and FirebaseFirestore.loadBundleStream start the task and return it at once. Wait for future, or follow stream to show progress:

final LoadBundleTask task = firestore.loadBundle(bundleBytes);
task.stream.listen((LoadBundleTaskSnapshot progress) {
  print('${progress.documentsLoaded} of ${progress.totalDocuments} documents');
});
final LoadBundleTaskSnapshot result = await task.future;
print('loaded ${result.documentsLoaded} documents');

Loading writes only to the local cache and needs no connection. A bundle that cannot be read fails the task with a FirestoreException (code invalidArgument). After a successful load the named queries of the bundle are available through FirebaseFirestore.namedQuery. Loading a bundle again whose id was already loaded with the same or a later creation time completes at once without changing the cache.

PORTING NOTE: the Android class extends Task<LoadBundleTaskSnapshot>. Here the task completion is exposed as future and the progress updates as stream.

Properties

future → Future<LoadBundleTaskSnapshot>
Completes with the final progress (state LoadBundleTaskState.success) once the bundle is loaded, or with the error if loading failed.
no setter
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
snapshot → LoadBundleTaskSnapshot
The last progress update; all counts are zero before the first one.
no setter
stream → Stream<LoadBundleTaskSnapshot>
The progress updates reported from now on. A final update with state LoadBundleTaskState.success or LoadBundleTaskState.error is the last event, after which the stream is closed. The stream is a broadcast stream: it does not replay updates that were reported before the listener subscribed (see snapshot), and a listener that subscribes after the task finished gets no event; use future for the result.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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