OptionFutureRedirector<T extends Object> extension
Collection of utils on Future<Option<T>>
Methods
-
and<
U extends Object> (Option< U> optb) → Future<Option< U> > -
Returns
None
if the option isNone
, otherwise returnsoptb
. -
andThen<
U extends Object> (Option< U> op(T)) → Future<Option< U> > -
Returns
None
if the option isNone
, otherwise callsop
with the wrapped value and returns the result. -
expect(
String msg) → Future< T> - Unwraps an option, yielding the content of a Some.
-
filter(
bool predicate(T)) → Future< Option< T> > -
Returns
None
if the option isNone
, otherwise callspredicate
with the wrapped value and returns: -
isNone(
) → Future< bool> -
Returns
true
if the option is aNone
value. -
isSome(
) → Future< bool> -
Returns
true
if the option is aSome
value. -
map<
U extends Object> (U op(T)) → Future< Option< U> > -
Maps an
Option<T>
toOption<U>
by applying a function to a containedSome
value. Otherwise returns aNone
. -
mapOr<
U> (U op(T), U opt) → Future< U> - Applies a function to the contained value (if any), or returns the provided default (if not).
-
mapOrElse<
U> (U op(T), U def()) → Future< U> -
Maps an
Option<T>
toU
by applying a function to a containedT
value, or computes a default (if not). -
match<
R> (R someop(T), R noneop()) → Future< R> -
Invokes either the
someop
or thenoneop
depending on the option. -
okOr<
E extends Object> (E err) → Future< Result< T, E> > -
Transforms the
Option<T>
into aResult<T, E>
, mappingSome(v)
toOk(v)
andNone
toErr(err)
. -
okOrElse<
E extends Object> (E err()) → Future< Result< T, E> > -
Transforms the
Option<T>
into aResult<T, E>
, mappingSome(v)
toOk(v)
andNone
toErr(err())
. -
or(
Option< T> optb) → Future<Option< T> > -
Returns the option if it contains a value, otherwise returns
optb
. -
orElse(
Option< T> op()) → Future<Option< T> > -
Returns the option if it contains a value, otherwise calls
op
and returns the result. -
toNullable(
) → Future< T?> - Returns an nullable that represents this optional value.
-
unwrap(
) → Future< T> -
Unwraps an option, yielding the content of a
Some
. -
unwrapOr(
T opt) → Future< T> - Returns the contained value or a default.
-
unwrapOrElse(
T op()) → Future< T> - Returns the contained value or computes it from a closure.
-
when<
R> ({required R some(T), required R none()}) → Future< R> -
Invokes either
some
ornone
depending on the option. -
xor(
Option< T> optb) → Future<Option< T> > -
Returns
Some
if exactly one ofthis
,optb
isSome
, otherwise returnsNone
.