OptionFutureRedirector<T extends Object> extension

Collection of utils on Future<Option<T>>

on

Methods

and<U extends Object>(Option<U> optb) Future<Option<U>>
Returns None if the option is None, otherwise returns optb.
andThen<U extends Object>(Option<U> op(T)) Future<Option<U>>
Returns None if the option is None, otherwise calls op 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 is None, otherwise calls predicate with the wrapped value and returns:
isNone() Future<bool>
Returns true if the option is a None value.
isSome() Future<bool>
Returns true if the option is a Some value.
map<U extends Object>(U op(T)) Future<Option<U>>
Maps an Option<T> to Option<U> by applying a function to a contained Some value. Otherwise returns a None.
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> to U by applying a function to a contained T value, or computes a default (if not).
match<R>(R someop(T), R noneop()) Future<R>
Invokes either the someop or the noneop depending on the option.
okOr<E extends Object>(E err) Future<Result<T, E>>
Transforms the Option<T> into a Result<T, E>, mapping Some(v) to Ok(v) and None to Err(err).
okOrElse<E extends Object>(E err()) Future<Result<T, E>>
Transforms the Option<T> into a Result<T, E>, mapping Some(v) to Ok(v) and None to Err(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 or none depending on the option.
xor(Option<T> optb) Future<Option<T>>
Returns Some if exactly one of this, optb is Some, otherwise returns None.