Option<A> class
sealed
Represents an optional value: every instance is either Some, containing a value, or None,
indicating the absence of a value. This pattern is an alternative to using nullable types
(null
) for representing the absence of a value.
Typical usages include representing results which might fail, or optional function arguments.
Example:
final someValue = Some(42);
final noValue = None<int>();
Constructors
- Option()
-
const
Properties
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited