None<T> class final

Represents the absence of a value.

final none = None<int>();
print(none.isNone); // true
Inheritance

Constructors

None()
Creates a None instance.
const

Properties

hashCode int
The hash code for this object.
no setteroverride
isNone bool
Returns true if this is None.
no setterinherited
isSome bool
Returns true if this is Some.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

filter(bool predicate(T t)) Option<T>
Returns this Option if it is Some and predicate returns 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 onNone if this is None, or onSome if 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 f if 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 action if 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