FutureOrExtension<T> extension
Extension for FutureOr.
- on
-
- FutureOr<
T>
- FutureOr<
Properties
-
asFuture
→ Future<
T> -
Returns a Future of this instance.
no setter
- genericType → Type
-
Returns the type of
T
.no setter - isResolved → bool
-
Returns
true
if this instance is aT
value (not a Future).no setter
Methods
-
onResolve<
R> (void callback(T r)) → FutureOr< void> -
Resolves this instance and calls
callback
. Returnsvoid
. -
resolve(
{FutureOr< bool> validate(T val)?, T? defaultValue}) → FutureOr<T> - Resolves this instance.
-
resolveBoth<
R> (FutureOr< T> other, FutureOr<R> resolver(T val1, T val2)) → FutureOr<R> -
Resolves
this
andother
withresolver
. -
resolveMapped<
R> (FutureOr< R> mapper(T val)) → FutureOr<R> -
Resolves this instance mapping to
mapper
and return its result. -
resolveOther<
R, E> (FutureOr< E> other, FutureOr<R> resolver(T val1, E val2)) → FutureOr<R> -
Resolves
this
andother
withresolver
. -
resolveWith<
R> (FutureOr< R> resolver()) → FutureOr<R> -
Resolves this instance with
resolver
result. -
resolveWithValue<
V> (V value) → FutureOr< V> -
Resolves this instance with
value
. -
then<
R> (FutureOr< R> onValue(T value), {Function? onError}) → FutureOr<R> - Same as Future.then.
-
validate(
FutureOr< bool> validate(T val)?, {T? defaultValue}) → FutureOr<T?> -
Validate
this
instance withvalidate
. ReturnsdefaultValue
if not valid or value is null.