AsyncSnapshotExtension<T> extension

Extension on AsyncSnapshot to handle its various states

on

Properties

errorMessage String?

Available on AsyncSnapshot<T>, provided by the AsyncSnapshotExtension extension

Returns the error message if the error is an Exception with a message, otherwise returns the string representation of the error.
no setter
hasNone bool

Available on AsyncSnapshot<T>, provided by the AsyncSnapshotExtension extension

Returns whether this snapshot has neither data/error.
no setter
isLoading bool

Available on AsyncSnapshot<T>, provided by the AsyncSnapshotExtension extension

Returns whether this snapshot is computing.
no setter
isReloading bool

Available on AsyncSnapshot<T>, provided by the AsyncSnapshotExtension extension

Returns whether this snapshot is computing and has data/error.
no setter

Methods

maybeWhen<R>({bool skipLoading = false, R data(T data)?, R error(Object error, StackTrace stackTrace)?, R loading()?, R none()?, required R orElse()}) → R

Available on AsyncSnapshot<T>, provided by the AsyncSnapshotExtension extension

Allows you to define custom behavior for different states of an AsyncSnapshot by providing callbacks for data, error, loading, and none.
when<R>({bool skipLoading = false, required R data(T data), required R error(Object error, StackTrace stackTrace), required R loading(), R none()?}) → R

Available on AsyncSnapshot<T>, provided by the AsyncSnapshotExtension extension

Allows you to define custom behavior for different states of an AsyncSnapshot by providing callbacks for data, error, loading, and none.
whenData<R>(R map(T data)) AsyncSnapshot<R>

Available on AsyncSnapshot<T>, provided by the AsyncSnapshotExtension extension

Applies map when this snapshot hasData.
whenError(Object map(Object error)) AsyncSnapshot<T>

Available on AsyncSnapshot<T>, provided by the AsyncSnapshotExtension extension

Applies map when this snapshot hasError.
whenOrNull<R>({bool skipLoading = false, R data(T data)?, R error(Object error, StackTrace stackTrace)?, R loading()?, R none()?}) → R?

Available on AsyncSnapshot<T>, provided by the AsyncSnapshotExtension extension

Allows you to define custom behavior for different states of an AsyncSnapshot by providing callbacks for data, error, loading, and none.