FutureOrExtension<T> extension

Extension for FutureOr.

on

Properties

asFuture Future<T>

Available on FutureOr<T>, provided by the FutureOrExtension extension

Returns a Future of this instance.
no setter
genericType Type

Available on FutureOr<T>, provided by the FutureOrExtension extension

Returns the type of T.
no setter
isResolved bool

Available on FutureOr<T>, provided by the FutureOrExtension extension

Returns true if this instance is a T value (not a Future).
no setter

Methods

onResolve<R>(void callback(T r)) FutureOr<void>

Available on FutureOr<T>, provided by the FutureOrExtension extension

Resolves this instance and calls callback. Returns void.
resolve({FutureOr<bool> validate(T val)?, T? defaultValue}) FutureOr<T>

Available on FutureOr<T>, provided by the FutureOrExtension extension

Resolves this instance.
resolveBoth<R>(FutureOr<T> other, FutureOr<R> resolver(T val1, T val2)) FutureOr<R>

Available on FutureOr<T>, provided by the FutureOrExtension extension

Resolves this and other with resolver.
resolveMapped<R>(FutureOr<R> mapper(T val)) FutureOr<R>

Available on FutureOr<T>, provided by the FutureOrExtension extension

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>

Available on FutureOr<T>, provided by the FutureOrExtension extension

Resolves this and other with resolver.
resolveWith<R>(FutureOr<R> resolver()) FutureOr<R>

Available on FutureOr<T>, provided by the FutureOrExtension extension

Resolves this instance with resolver result.
resolveWithValue<V>(V value) FutureOr<V>

Available on FutureOr<T>, provided by the FutureOrExtension extension

Resolves this instance with value.
then<R>(FutureOr<R> onValue(T value), {Function? onError}) FutureOr<R>

Available on FutureOr<T>, provided by the FutureOrExtension extension

Same as Future.then.
validate(FutureOr<bool> validate(T val)?, {T? defaultValue}) FutureOr<T?>

Available on FutureOr<T>, provided by the FutureOrExtension extension

Validate this instance with validate. Returns defaultValue if not valid or value is null.