None<T> class final

Represents a value that does not exist.

Inheritance

Constructors

None()
const

Properties

hashCode int
The hash code for this object.
no setterinherited
isNone bool
no setterinherited
isSome bool
no setterinherited
none None<T>
Get the None value or throw an error if it's Some.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
some Some<T>
Get the Some value or throw an error if it's None.
no setterinherited

Methods

andThen<U>(Option<U> fn(T value)) Option<U>
If it's Some, apply the function to the value, else return None.
inherited
filter(bool predicate(T value)) Option<T>
Applies the function only if the Option is Some, otherwise returns None.
inherited
fold<B>(B onSome(T value), B onNone()) → B
Fold is used to handle both Some and None cases.
override
getOrElse(T defaultValue()) → T
Transform the Option into a value using a default if None.
inherited
isSomeAnd(bool predicate(T value)) bool
Checks if the Option contains a value.
inherited
map<U>(U fn(T value)) Option<U>
Maps the value inside Some if it exists.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
orElse(Option<T> alternative()) Option<T>
Returns Option if Some, or None otherwise.
inherited
toString() String
A string representation of this object.
inherited
unwrap() → T
Unwrap the value or throw an error if it's None.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited