Maybe<T> class

A pure virtual class that represents a union of "has value (Some)" and "no value (None)"

Implementers

Constructors

Maybe(T val)
Create a Some
const
factory
Maybe.None()
Create a None
const
factory
Maybe.Some(T val)
Create a Some
const
factory

Properties

has bool
Get whether it has Value
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
val → T
Get the Value if it has
read-only

Methods

defaultVal(T v) Some<T>
Set a default value when it is None
defaultValFn(T fn()) Some<T>
Set a default value when it is None [...]
none<R>(R none()) Maybe<R>
When it not has Value Return Some(none(it)) [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
some<R>(R some(T val)) Maybe<R>
fMap [...]
toString() String
Returns a string representation of this object.
inherited
when<R>({R some(T val), R none()}) Maybe<R>
Pattern matching [...]

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited