Option<Value> class sealed

Implementers

Constructors

Option.from(dynamic value)
Constructs a Option from a dynamic value If the value is Option it will return the value itself If the value is Value it will return Some<Value> otherwise returns None
factory
Option.none()
factory
Option.ok(Value value)
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

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 /(dynamic a) → dynamic
Returns None or throws an error if it is Some Convinient operator to get the error from the result, user should ensure that the value is None, otherwise it will throw an UnimplementedError Usage: final res = Option.none(); final err = res / 0; assert(err is None);
operator ==(Object other) bool
The equality operator.
inherited
operator |(dynamic a) → Value
Returns the Value if it is Some or throws an error if it is None Convinient operator to get the value from the result, user should ensure that the result is Some, otherwise it will throw an UnimplementedError Usage: final res = Option
operator ~() → dynamic
Returns the inner Value from Some or None Convinient operator to get the inner value from the Option, Usage: final res = Option