ConstNonNullableOnceCell<T extends Object> class
OnceCell, A cell which can be written to only once. OnceCell implementation based off Option with a const constructor
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.
- Implemented types
-
- OnceCell<
T>
- OnceCell<
Constructors
- ConstNonNullableOnceCell(Object id)
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- id → Object
-
Const objects all share the same canonicalization, meaning instantiation of the same class with the same arguments
will be the same instance. Therefore, if you need multiple const versions, an id is needed.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
get(
) → Option< T> -
Gets the reference to the underlying value.
override
-
getOrInit(
T func()) → T -
Gets the contents of the cell, initializing it with
func
if the cell was empty.override -
getOrNull(
) → T? -
Gets the underlying value, returns null if the cell is empty
override
-
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.
override
-
isSet(
) → bool -
Returns true if the value has been set. Returns false otherwise.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
set(
T value) → Result< (), T> -
Sets the contents of the cell to value.
override
-
setOrNull(
T value) → T? -
Sets the contents of the cell to value. Returns null if the value is already set.
override
-
take(
) → Option< T> -
Takes the value out of this OnceCell, moving it back to an uninitialized state.
override
-
takeOrNull(
) → T? -
Takes the value out of this OnceCell, moving it back to an uninitialized state. Returns null if the cell is empty.
override
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override