FutureOrExtension<T> extension

Extension for FutureOr.

on

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 a T value (not a Future).
no setter

Methods

onResolve<R>(void callback(T r)) FutureOr<void>
Resolves this instance and calls callback. Returns void.
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 and other with resolver.
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 and other with resolver.
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 with validate. Returns defaultValue if not valid or value is null.