None<T extends Object> class

Type None<T> is an Option that does not contain any value.

You can construct a None using the None() constructor or by calling the Option.none() factory constructor. A None is also returned when a null is passed to the Option.some() factory constructor.

Inheritance

Constructors

None()
Create a None option with no value.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
props List<Object>
The list of properties that will be used to determine whether two instances are equal.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited

Methods

and<U extends Object>(Option<U> optb) Option<U>
Returns None if the option is None, otherwise returns optb.
inherited
andThen<U extends Object>(Option<U> op(T)) Option<U>
Returns None if the option is None, otherwise calls op with the wrapped value and returns the result.
inherited
expect(String msg) → T
Unwraps an option, yielding the content of a Some.
inherited
filter(bool predicate(T)) Option<T>
Returns None if the option is None, otherwise calls predicate with the wrapped value and returns:
inherited
isNone() bool
Returns true if the option is a None value.
inherited
isSome() bool
Returns true if the option is a Some value.
inherited
map<U extends Object>(U op(T)) Option<U>
Maps an Option<T> to Option<U> by applying a function to a contained Some value. Otherwise returns a None.
inherited
mapOr<U>(U op(T), U opt) → U
Applies a function to the contained value (if any), or returns the provided default (if not).
inherited
mapOrElse<U>(U op(T), U def()) → U
Maps an Option<T> to U by applying a function to a contained T value, or computes a default (if not).
inherited
match<R>(R someop(T), R noneop()) → R
Invokes either the someop or the noneop depending on the option.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
okOr<E extends Object>(E err) Result<T, E>
Transforms the Option<T> into a Result<T, E>, mapping Some(v) to Ok(v) and None to Err(err).
inherited
okOrElse<E extends Object>(E err()) Result<T, E>
Transforms the Option<T> into a Result<T, E>, mapping Some(v) to Ok(v) and None to Err(err()).
inherited
or(Option<T> optb) Option<T>
Returns the option if it contains a value, otherwise returns optb.
inherited
orElse(Option<T> op()) Option<T>
Returns the option if it contains a value, otherwise calls op and returns the result.
inherited
toNullable() → T?
Returns an nullable that represents this optional value.
toString() String
A string representation of this object.
inherited
unwrap() → T
Unwraps an option, yielding the content of a Some.
inherited
unwrapOr(T opt) → T
Returns the contained value or a default.
inherited
unwrapOrElse(T op()) → T
Returns the contained value or computes it from a closure.
inherited
when<R>({required R some(T), required R none()}) → R
Invokes either some or none depending on the option.
inherited
xor(Option<T> optb) Option<T>
Returns Some if exactly one of this, optb is Some, otherwise returns None.
inherited

Operators

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