Some<T> class final

An Option with a value.

Inheritance
Available Extensions

Constructors

Some(T value)
Creates an Option with the given value.
const

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, or null otherwise.
no setteroverride

Methods

and<U>(Option<U> other) Option<U>
Returns other if this is a Some, or None otherwise.
override
andThen<U>(Option<U> calculateOther(T value)) Option<U>
Returns the result of calculateOther if this is a Some, or None otherwise.
override
contains(T value) bool
Returns true if this is a Some of the given value.
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 if this is a Some with a contained value that satisfies condition.
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, or defaultValue 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 of calculateDefaultValue 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, or other otherwise.
override
orElse(Option<T> calculateOther()) Some<T>
Returns a Some of the original value if this is a Some, or the result of calculateOther 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 satisfies condition, 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 type U, or None otherwise.
override
xor(Option<T> other) Option<T>
Returns a Some if either, but not both, of this and other is a Some, or None otherwise.
override
zip<U>(Option<U> other) Option<(T, U)>
Returns a tuple of both this and other 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 both this and other if both are Some, or None otherwise.
override

Operators

operator ==(covariant Option<T> other) bool
The equality operator.
override