Some<T> class
final
- Implemented types
-
- Option<
T>
- Option<
- Available extensions
Constructors
- Some.new(T v)
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- v → T
-
final
Methods
-
and<
U> (Option< U> other) → Option<U> -
Returns None if the option is None, otherwise returns
other
.override -
andThen<
U> (Option< U> f(T self)) → Option<U> -
Returns None if the option is None, otherwise calls f with the wrapped value and returns the result. Some
languages call this operation flatmap.
override
-
copy(
) → Some< T> -
Shallow copies this Option
override
-
expect(
String msg) → T -
Returns the contained Some value if Some, otherwise throws a Panic.
override
-
filter(
bool predicate(T self)) → Option< T> -
Returns None if the option is None, otherwise calls predicate with the wrapped value and returns
Some(t) if predicate returns true (where t is the wrapped value), and
override
-
flatten(
) → Option< (A, B, C)> -
Available on Option<
Flattens an option into a single tuple.((A, B), C)> , provided by the Option$OptionNestedRecord3Extension extension -
flatten(
) → Option< (A, B, C, D)> -
Available on Option<
Flattens an option into a single tuple.(((A, B), C), D)> , provided by the Option$OptionNestedRecord4Extension extension -
flatten(
) → Option< T> -
Available on Option<
Converts from Option<OptionOption< , provided by the Option$OptionOptionExtension extensionT> > -
flatten(
) → Option< T> -
Available on Option<
Converts from Option<T?> to OptionT?> , provided by the Option$OptionNullableExtension extension -
flatten(
) → Option< (A, B, C, D, E)> -
Available on Option<
Flattens an option into a single tuple.((((A, B), C), D), E)> , provided by the Option$OptionNestedRecord5Extension extension -
inspect(
dynamic f(T self)) → Some< T> -
Calls the provided closure with a reference to the contained value
override
-
isNone(
) → bool -
Returns true if the option is a None value.
override
-
isSome(
) → bool -
Returns true if the option is a Some value.
override
-
isSomeAnd(
bool f(T self)) → bool -
Returns true if the option is a Some and the value inside of it matches a predicate.
override
-
iter(
) → Iter< T> -
Returns an Iter over the possibly contained value.
override
-
map<
U> (U f(T self)) → Some< U> -
Maps an this Option
override
-
mapOr<
U> (U defaultValue, U f(T)) → U -
Returns the provided default result (if none), or applies a function to the contained value (if any).
override
-
mapOrElse<
U> (U defaultFn(), U f(T)) → U -
Computes a default function result (if none), or applies a different function to the contained value (if any).
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
okOr<
E extends Object> (E err) → Ok< T, E> -
Transforms the Option
override
-
okOrElse<
E extends Object> (E errFn()) → Ok< T, E> -
Transforms the Option
override
-
or(
Option< T> other) → Option<T> -
Available on Option<
Returns the option if it contains a value, otherwise returnsT> , provided by the Option$NoneExtension extensionother
-
or(
Option< T> other) → Some<T> - Returns the option if it contains a value, otherwise returns other.
-
orElse(
Option< T> f()) → Option<T> -
Available on Option<
Returns the option if it contains a value, otherwise calls f and returns the result.T> , provided by the Option$NoneExtension extension -
orElse(
Option< T> f()) → Some<T> - Returns this value as Some
-
toFutureOption(
) → Future< Option< T> > -
Available on Option<
Converts a OptionT> , provided by the Option$ToFutureOptionExtension extension -
toNullable(
) → T -
override
-
toString(
) → String -
A string representation of this object.
override
-
transpose(
) → Result< Option< S> , F> -
Available on Option<
Transposes an Option of a Result into a Result of an Option.Result< , provided by the Option$OptionResultExtension extensionS?, F> > -
unwrap(
) → T -
Returns the contained Some value, consuming the self value.
override
-
unwrapOr(
T defaultValue) → T -
Available on Option<
Returns the contained Some value or a provided default.T> , provided by the Option$NoneExtension extension -
unwrapOr(
T defaultValue) → T - Returns this value
-
unwrapOrElse(
T f()) → T -
Available on Option<
Returns the option if it contains a value, otherwise returns other.T> , provided by the Option$NoneExtension extension -
unwrapOrElse(
T f()) → T - Returns this value
-
unzip(
) → (Option< T> , Option<U> ) -
Available on Option<
Unzips an option containing a tuple of two options. If self is Some((a, b)) this method returns (Some(a), Some(b)). Otherwise, (None, None) is returned.(T, U)> , provided by the Option$OptionRecord2Extension extension -
xor(
Option< T> other) → Option<T> -
Returns Some if the
other
is not Some -
xor(
Option< T> other) → Option<T> -
Available on Option<
Returns Some if exactly one of this orT> , provided by the Option$NoneExtension extensionother
is Some, otherwise returns None. -
zip<
U> (Option< U> other) → Option<(T, U)> -
Zips self with another Option.
override
-
zipWith<
U, R> (Option< U> other, R f(T p1, U p2)) → Option<R> -
Zips self and another Option with function f
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
-
operator [](
_OptionEarlyReturnKey op) → T -
Functions an "Early Return Operator" when given an "Early Return key" "$". See
Option.$
for more information.override