None<T> class
final
Represents the absence of a value.
final none = None<int>();
print(none.isNone); // true
Properties
Methods
-
filter(
bool predicate(T t)) → Option< T> -
Returns this Option if it is Some and
predicatereturns true. Otherwise returns None.override -
flatMap<
R> (Option< R> f(T t)) → Option<R> -
Chains a computation that returns an Option, avoiding nesting.
override
-
fold<
W> (W onNone(), W onSome(T t)) → W -
Applies
onNoneif this is None, oronSomeif this is Some.override -
getOrElse(
T defaultValue()) → T -
Returns the contained value if Some, otherwise returns
defaultValue.override -
map<
R> (R f(T t)) → Option< R> -
Transforms the contained value using
fif this is Some.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
tap(
void action(T t)) → Option< T> -
Executes
actionif this is Some, then returns this unchanged.override -
toNullable(
) → T? -
Returns the contained value if Some, otherwise returns
null.override -
toResult<
L> (L onNone()) → Result< L, T> -
Converts this Option to a Result.
override
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override