SelfCell<T> class
A computed cell which can access its current value in the compute function.
This cell is identical to a computed cell created with ValueCell.computed,
but the compute function is called with a self
argument. The self
argument is a function that when called returns the last computed value of
the SelfCell. If there is no last computed value UninitializedCellError
is thrown when calling the self
function.
Example:
final count = SelfCell((self) => self() + delta(),
initialValue: 0
)
- Inheritance
-
- Object
- ValueCell<
T> - StatefulCell<
T> - SelfCell
- Implemented types
- Available extensions
- ActionCellEffectExtension
- ActionCellExtension
- BoolCellExtension
- BoolValueChangeExtension
- CellHolderExtension
- ComputeArgumentsTracker
- ComputeExtension
- DelayCellExtension
- DurationCellExtension
- EffectCellExtension
- ErrorCellExtension
- IterableCellExtension
- ListCellExtension
- MapCellExtension
- MaybeCellExtension
- NullCheckExtension
- NumericExtension
- PeekCellExtension
- PrevValueCellExtension
- SetCellExtension
- StoreCellExtension
- TransformExtension
- ValueChangeExtension
- WaitCellExtension
Constructors
-
SelfCell(SelfCompute<
T> compute, {T? initialValue, dynamic key}) -
Create a computed cell which can access its own value.
factory
Properties
- equalityCellFactory → EqualityCellFactory
-
Return a factory for creating equality and inequality comparison cells.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasState → bool
-
Does this cell have a state?
no setterinherited
- key ↔ dynamic
-
Key which uniquely identifies the cell
latefinalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
state
→ SelfCellState<
T> ? -
The current state of the cell, or null if the cell is inactive.
no setter
- value → T
-
The cell's value
no setterinherited
Methods
-
addObserver(
CellObserver observer) → void -
Register an observer of the cell to be called when the cell's value changes.
inherited
-
call(
) → T -
Retrieve the value of the cell.
inherited
-
createState(
) → CellState< StatefulCell> - Create the CellState for this cell.
-
dumpState(
CellValueCoder coder) → Object? -
Dump the state of the cell to a value.
inherited
-
eq<
U> (ValueCell< U> other) → ValueCell<bool> -
Returns a new ValueCell which compares the value of this cell to another cell for equality.
inherited
-
neq<
U> (ValueCell< U> other) → ValueCell<bool> -
Returns a new ValueCell which compares the value of this cell to another cell for inequality.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
observe(
) → void -
Track this cell as an argument of the current compute/watch function.
inherited
-
removeObserver(
CellObserver observer) → void -
Remove an observer that was previously registered with addObserver.
inherited
-
restoreState(
Object? state, CellValueCoder coder) → void -
Restore the state of the cell.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited