Optional<T> class abstract

Implementers
Available extensions

Constructors

Optional()
const

Properties

hashCode int
The hash code for this object.
no setterinherited
isBlank bool

Available on OptionalString, provided by the OptionalStrings extension

no setter
isNotBlank bool

Available on OptionalString, provided by the OptionalStrings extension

no setter
isPresent bool
no setter
length int

Available on OptionalList<T>, provided by the OptionalLists extension

no setter
length int

Available on OptionalString, provided by the OptionalStrings extension

no setter
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setterinherited
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

asEmpty() Empty<T>
asPresent() Present<T>
conditionally<N>(bool condition(Optional<T>), Optional<N> mapper(Optional<T>)) Optional<N>
equals(T value) bool
filter(Predicate<T> predicate) Optional<T>
flatMap<N>(Optional<N> mapper(T)) Optional<N>
fold<R>(R initial, R reducer(R, T)) Optional<R>

Available on OptionalList<T>, provided by the OptionalLists extension

ifEmpty(void ignored()) Optional<T>
ifPresent(void action(T)) Optional<T>
join([String separator = ' ']) OptionalString

Available on OptionalList<T>, provided by the OptionalLists extension

map<N>(N mapper(T)) Optional<N>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
optionally<X, N>(Optional<X> optional, Optional<N> optionalTuple(Optional<T>, Optional<X>)) Optional<N>
orElse(Supplier<T> supplier) → T
orElseGet(T value) → T
orThrow(Exception exception) → T
reduce(T reducer(T, T)) Optional<T>

Available on OptionalList<T>, provided by the OptionalLists extension

run(void action(Optional<T>)) Optional<T>
split(Pattern pattern) OptionalList<String>

Available on OptionalString, provided by the OptionalStrings extension

toList() List<T>
toSet() Set<T>
toString() String
A string representation of this object.
inherited
trim() OptionalString

Available on OptionalString, provided by the OptionalStrings extension

Operators

operator *(OptionalNum that) OptionalNum

Available on OptionalNum, provided by the OptionalNums extension

operator *(int times) OptionalString

Available on OptionalString, provided by the OptionalStrings extension

operator +(OptionalList<T> that) OptionalList<T>

Available on OptionalList<T>, provided by the OptionalLists extension

operator +(OptionalNum that) OptionalNum

Available on OptionalNum, provided by the OptionalNums extension

operator +(OptionalString that) OptionalString

Available on OptionalString, provided by the OptionalStrings extension

operator -(OptionalNum that) OptionalNum

Available on OptionalNum, provided by the OptionalNums extension

operator /(OptionalNum that) OptionalNum

Available on OptionalNum, provided by the OptionalNums extension

operator ==(Object other) bool
The equality operator.
inherited
operator ~/(OptionalNum that) OptionalNum

Available on OptionalNum, provided by the OptionalNums extension

Static Methods

empty<T>() Empty<T>
of<T>(T? value) Optional<T>