OnceCellNullable<T> class
OnceCell, A cell which can be written to only once. Allows T
to be null. Use OnceCell if
T
does not need to be null.
Equality: Cells are equal if they have the same value or are not set.
Hash: Cells hash to their existing or the same if not set.
Constructors
-
OnceCellNullable.new([Option<
T> ? value])
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getOrInit(
T func()) → T -
Gets the contents of the cell, initializing it with
func
if the cell was empty. -
getOrNull(
) → T? - Gets the underlying value, returns null if the cell is empty
-
getOrOption(
) → Option< T> - Gets the underlying value, returns None if the cell is empty
-
getOrTryInit<
E extends Object> (Result< T, E> f()) → Result<T, E> - Gets the contents of the cell, initializing it with f if the cell was empty. If the cell was empty and f failed, an error is returned.
-
isSet(
) → bool - Returns true if the value has been set. Returns false otherwise.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setOrNull(
T value) → T? - Sets the contents of the cell to value. Returns null if the value is already set. Otherwise returns the input value.
-
setOrOption(
T value) → Option< T> - Sets the contents of the cell to value. Returns a None if the value is already set. Otherwise returns Some of the input value.
-
takeOrNull(
) → T? - Takes the value out of this OnceCell, moving it back to an uninitialized state. Returns null if the cell is empty.
-
takeOrOption(
) → Option< T> - Takes the value out of this OnceCell, moving it back to an uninitialized state. Returns a None if the cell is empty.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override