async_snapshot_exts library
Extensions
-
AsyncSnapshotResultExtension
on AsyncSnapshot<
T> - Extension methods on AsyncSnapshot that provide a Result-like API similar to Kotlin and Rust's Result class, but with an additional "pending" state.
Functions
-
err<
T> (Object error, [StackTrace? stackTrace]) → AsyncSnapshot< T> - Creates an AsyncSnapshot with an error (equivalent to Result.err)
-
fromFuture<
T> (Future< T> future) → Future<AsyncSnapshot< T> > - Boxes a Future into an AsyncSnapshot (i.e. captures errors into a snapshot)
-
ok<
T> (T value) → AsyncSnapshot< T> - Creates an AsyncSnapshot with a successful value (equivalent to Result.ok)
-
pending<
T> () → AsyncSnapshot< T> - Creates a pending AsyncSnapshot (equivalent to Result.pending)