Some<T> class
final
An Option with a value.
- Inheritance
- Available Extensions
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- isNone → bool
-
Whether
this
is a None.no setteroverride - isSome → bool
-
Whether
this
is a Some.no setteroverride -
iterable
→ Iterable<
T> -
Returns an iterable over the possibly contained value.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → T
-
The contained value.
final
- valueOrNull → T
-
The contained value if
this
is a Some, ornull
otherwise.no setteroverride
Methods
-
and<
U> (Option< U> other) → Option<U> -
Returns
other
ifthis
is a Some, or None otherwise.override -
andThen<
U> (Option< U> calculateOther(T value)) → Option<U> -
Returns the result of
calculateOther
ifthis
is a Some, or None otherwise.override -
contains(
T value) → bool -
Returns
true
ifthis
is a Some of the givenvalue
.override -
inspect(
void inspect(T value)) → Some< T> -
Calls inspect with the contained value if
this
is a Some.override -
isSomeAnd(
bool condition(T value)) → bool -
Returns
true
ifthis
is a Some with a contained value that satisfiescondition
.override -
map<
U> (U map(T value)) → Some< U> -
Transforms the contained value, if any, by applying map to it.
override
-
mapOr<
U> (U map(T value), U defaultValue) → U -
Returns the contained value, if any, with
map
applied to it, ordefaultValue
otherwise.override -
mapOrElse<
U> (U map(T value), U calculateDefaultValue()) → U -
Returns the contained value, if any, with
map
applied to it, or the result ofcalculateDefaultValue
otherwise.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
okOr<
E> (E error) → Ok< T, E> -
Transforms an Option into a Result, mapping Some to an Ok of the contained value and
None to Err of
error
.override -
okOrElse<
E> (E calculateError()) → Ok< T, E> -
Transforms an Option into a Result, mapping Some to an Ok of the contained value and
None to Err of the result of
calculateError
.override -
or(
Option< T> other) → Some<T> -
Returns a Some of the original value if
this
is a Some, orother
otherwise.override -
orElse(
Option< T> calculateOther()) → Some<T> -
Returns a Some of the original value if
this
is a Some, or the result ofcalculateOther
otherwise.override -
toString(
) → String -
A string representation of this object.
override
-
unwrap(
{String? msg}) → T -
Returns the contained value.
override
-
unwrapOr(
T defaultValue) → T -
Returns the contained value, if any, or
defaultValue
otherwise.override -
unwrapOrElse(
T calculateDefaultValue()) → T -
Returns the contained value, if any, or the result of
calculateDefaultValue
otherwise.override -
where(
bool condition(T value)) → Option< T> -
Returns a Some of the original value if
this
is a Some and its contained value satisfiescondition
, or None otherwise.override -
whereType<
U> () → Option< U> -
Returns a Some of the original value if
this
is a Some with a contained value of typeU
, or None otherwise.override -
xor(
Option< T> other) → Option<T> -
Returns a Some if either, but not both, of
this
andother
is a Some, or None otherwise.override -
zip<
U> (Option< U> other) → Option<(T, U)> -
Returns a tuple of both
this
andother
if both are Some, or None otherwise.override -
zipWith<
U, R> (Option< U> other, R zip(T value, U otherValue)) → Option<R> -
Returns the result of
zip
called with boththis
andother
if both are Some, or None otherwise.override
Operators
-
operator ==(
covariant Option< T> other) → bool -
The equality operator.
override