Some<T> class final

Implemented types
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<((A, B), C)>, provided by the Option$OptionNestedRecord3Extension extension

Flattens an option into a single tuple.
flatten() Option<(A, B, C, D)>

Available on Option<(((A, B), C), D)>, provided by the Option$OptionNestedRecord4Extension extension

Flattens an option into a single tuple.
flatten() Option<T>

Available on Option<Option<T>>, provided by the Option$OptionOptionExtension extension

Converts from Option<Option
flatten() Option<T>

Available on Option<T?>, provided by the Option$OptionNullableExtension extension

Converts from Option<T?> to Option
flatten() Option<(A, B, C, D, E)>

Available on Option<((((A, B), C), D), E)>, provided by the Option$OptionNestedRecord5Extension extension

Flattens an option into a single tuple.
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<T>, provided by the Option$NoneExtension extension

Returns the option if it contains a value, otherwise returns other
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<T>, provided by the Option$NoneExtension extension

Returns the option if it contains a value, otherwise calls f and returns the result.
orElse(Option<T> f()) Some<T>
Returns this value as Some
toFutureOption() Future<Option<T>>

Available on Option<T>, provided by the Option$ToFutureOptionExtension extension

Converts a Option
toNullable() → T
override
toString() String
A string representation of this object.
override
transpose() → Result<Option<S>, F>

Available on Option<Result<S?, F>>, provided by the Option$OptionResultExtension extension

Transposes an Option of a Result into a Result of an Option.
unwrap() → T
Returns the contained Some value, consuming the self value.
override
unwrapOr(T defaultValue) → T

Available on Option<T>, provided by the Option$NoneExtension extension

Returns the contained Some value or a provided default.
unwrapOr(T defaultValue) → T
Returns this value
unwrapOrElse(T f()) → T

Available on Option<T>, provided by the Option$NoneExtension extension

Returns the option if it contains a value, otherwise returns other.
unwrapOrElse(T f()) → T
Returns this value
unzip() → (Option<T>, Option<U>)

Available on Option<(T, U)>, provided by the Option$OptionRecord2Extension extension

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.
xor(Option<T> other) Option<T>
Returns Some if the other is not Some
xor(Option<T> other) Option<T>

Available on Option<T>, provided by the Option$NoneExtension extension

Returns Some if exactly one of this or other 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