PreloadRequest class
A single Preload.load in flight.
It publishes its state as a PreloadSnapshot through value, notifies its listeners as assets land, and completes as a Future of the terminal snapshot. A failure is delivered to every awaiter and recorded on the snapshot. Dispose it once you are done with it:
final request = Ignis.preload.load(manifest: true);
// ...drive a progress bar from `request.value`...
await request;
request.dispose();
Disposing a running request cancels it: assets not yet loading are skipped, in-flight ones finish into the cache, and listeners and awaiters receive one final snapshot with PreloadSnapshot.cancelled set.
- Inheritance
-
- Object
- ChangeNotifier
- ValueNotifier<
PreloadSnapshot> - PreloadRequest
- Implemented types
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value ↔ PreloadSnapshot
-
The current value stored in this notifier.
getter/setter pairinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
asStream(
) → Stream< PreloadSnapshot> -
Creates a Stream containing the result of this future.
override
-
catchError(
Function onError, {bool test(Object)?}) → Future< PreloadSnapshot> -
Handles errors emitted by this Future.
override
-
dispose(
) → void -
Cancels the load if it is still running, then discards this notifier.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
then<
R> (FutureOr< R> onValue(PreloadSnapshot), {Function? onError}) → Future<R> -
Register callbacks to be called when this future completes.
override
-
timeout(
Duration limit, {FutureOr< PreloadSnapshot> onTimeout()?}) → Future<PreloadSnapshot> -
Stop waiting for this future after
timeLimithas passed.override -
toString(
) → String -
A string representation of this object.
inherited
-
whenComplete(
FutureOr< void> action()) → Future<PreloadSnapshot> -
Registers a function to be called when this future completes.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited