StatefulCell<T> class
abstract
A cell with the state managed by a CellState object.
This class should be subclassed if you need to create a cell type that manages its own observers or stores its own value. The state of the cell, the observers and its value, should be stored in the CellState object rather than the StatefulCell. This is to allow multiple ValueCell objects with the same key to reference the same CellState, and hence share the same state.
NOTE:
The CellState only exists while it has at least one observer. If the CellState has no observers then effectively this cell has no state, it is inactive. Inactive cells should handle accesses to their values as gracefully as possible. For example an computed cell will simply recompute its value whenever it is accessed while it is inactive.
- Inheritance
- Implementers
- 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
- StatefulCell({dynamic key})
-
Create a cell identified by
key
.
Properties
-
asyncState
→ ValueCell<
AsyncState< T> > -
Available on FutureCell<
A cell that evaluates to the AsyncState of the Future in this cell.T> , provided by the WaitCellExtension extensionno setter -
awaited
→ ValueCell<
T> -
Available on FutureCell<
A cell that awaits the Future held inT> , provided by the WaitCellExtension extensionthis
.no setter -
cellList
→ ValueCell<
Iterable< ValueCell< >T> > -
Available on ValueCell<
Returns a cell which wraps the elements of the List held in this cell in ValueCells.List< , provided by the ListCellExtension extensionT> >no setter -
effectCell
→ ValueCell<
T> -
Available on ValueCell<
Create a cell for observing side effects defined inT> , provided by the EffectCellExtension extensionthis
cell.no setter -
entries
→ ValueCell<
Iterable< MapEntry< >K, V> > -
Available on ValueCell<
Returns a cell which evaluates to Map.entries applied on the value in this cell.Map< , provided by the MapCellExtension extensionK, V> >no setter - equalityCellFactory → EqualityCellFactory
-
Return a factory for creating equality and inequality comparison cells.
no setterinherited
- error → ValueCell
-
Available on ValueCell<
A cell which evaluates to the error of the Maybe.Maybe< , provided by the MaybeCellExtension extensionT> >no setter -
first
→ ValueCell<
T> -
Available on ValueCell<
Returns a cell which evaluates to Iterable.first applied on the value in this cell.Iterable< , provided by the IterableCellExtension extensionT> >no setter - hashCode → int
-
The hash code for this object.
no setteroverride
- hasState → bool
-
Does this cell have a state?
no setter
-
inDays
→ ValueCell<
int> -
Available on ValueCell<
The duration in units of days, see Duration.inDaysDuration> , provided by the DurationCellExtension extensionno setter -
inHours
→ ValueCell<
int> -
Available on ValueCell<
The duration in units of hours, see Duration.inHoursDuration> , provided by the DurationCellExtension extensionno setter -
inMicroseconds
→ ValueCell<
int> -
Available on ValueCell<
The duration in units of microseconds, see Duration.inMicrosecondsDuration> , provided by the DurationCellExtension extensionno setter -
inMilliseconds
→ ValueCell<
int> -
Available on ValueCell<
The duration in units of milliseconds, see Duration.inMillisecondsDuration> , provided by the DurationCellExtension extensionno setter -
inMinutes
→ ValueCell<
int> -
Available on ValueCell<
The duration in units of minutes, see Duration.inMinutesDuration> , provided by the DurationCellExtension extensionno setter -
inSeconds
→ ValueCell<
int> -
Available on ValueCell<
The duration in units of seconds, see Duration.inSecondsDuration> , provided by the DurationCellExtension extensionno setter -
isCompleted
→ ValueCell<
bool> -
Available on FutureCell<
A cell that is true when the Future in this has completed, false otherwise.T> , provided by the WaitCellExtension extensionno setter -
isEmpty
→ ValueCell<
bool> -
Available on ValueCell<
Returns a cell which evaluates to Iterable.isEmpty applied on the value in this cell.Iterable< , provided by the IterableCellExtension extensionT> >no setter -
isEmpty
→ ValueCell<
bool> -
Available on ValueCell<
Returns a cell which evaluates to Map.isEmpty applied on the value in this cellMap< , provided by the MapCellExtension extensionK, V> >no setter -
isFinite
→ ValueCell<
bool> -
Available on ValueCell<
num> , provided by the NumericExtension extensionno setter -
isInfinite
→ ValueCell<
bool> -
Available on ValueCell<
num> , provided by the NumericExtension extensionno setter -
isNaN
→ ValueCell<
bool> -
Available on ValueCell<
num> , provided by the NumericExtension extensionno setter -
isNegative
→ ValueCell<
bool> -
Available on ValueCell<
Returns a cell, the value of which is true ifDuration> , provided by the DurationCellExtension extensionthis
is negative, see Duration.isNegative.no setter -
isNotEmpty
→ ValueCell<
bool> -
Available on ValueCell<
Returns a cell which evaluates to Iterable.isNotEmpty applied on the value in this cell.Iterable< , provided by the IterableCellExtension extensionT> >no setter -
isNotEmpty
→ ValueCell<
bool> -
Available on ValueCell<
Returns a cell which evaluates to Map.isNotEmpty applied on the value in this cellMap< , provided by the MapCellExtension extensionK, V> >no setter - key ↔ dynamic
-
Key which uniquely identifies the cell
latefinal
-
keys
→ ValueCell<
Iterable< K> > -
Available on ValueCell<
Returns a cell which evaluates to Map.keys applied on the value in this cell.Map< , provided by the MapCellExtension extensionK, V> >no setter -
last
→ ValueCell<
T> -
Available on ValueCell<
Returns a cell which evaluates to Iterable.last applied on the value in this cell.Iterable< , provided by the IterableCellExtension extensionT> >no setter -
length
→ ValueCell<
int> -
Available on ValueCell<
Returns a cell which evaluates to Iterable.length applied on the value in this cell.Iterable< , provided by the IterableCellExtension extensionT> >no setter -
length
→ ValueCell<
int> -
Available on ValueCell<
Returns a cell which evaluates to Map.length applied on the value in this cellMap< , provided by the MapCellExtension extensionK, V> >no setter -
notNull
→ ValueCell<
T> -
Available on ValueCell<
A cell that is guaranteed to hold a non-null value.T?> , provided by the NullCheckExtension extensionno setter -
peek
→ ValueCell<
T> -
Available on ValueCell<
Use the value ofT> , provided by the PeekCellExtension extensionthis
without reacting to changes.no setter -
previous
→ ValueCell<
T> -
Available on ValueCell<
Return a cell which holds the previous value ofT> , provided by the PrevValueCellExtension extensionthis
cell.no setter -
reversed
→ ValueCell<
Iterable< T> > -
Available on ValueCell<
Returns a cell which evaluates to List.reversed applied on the value in this cell.List< , provided by the ListCellExtension extensionT> >no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
sign
→ ValueCell<
num> -
Available on ValueCell<
num> , provided by the NumericExtension extensionno setter -
single
→ ValueCell<
T> -
Available on ValueCell<
Returns a cell which evaluates to Iterable.single applied on the value in this cell.Iterable< , provided by the IterableCellExtension extensionT> >no setter -
state
→ CellState<
StatefulCell> ? -
The current state of the cell, or null if the cell is inactive.
no setter
- unwrap → ValueCell
-
Available on ValueCell<
A cell which evaluates to the unwrapped value (by Maybe.unwrap) of the Maybe.Maybe< , provided by the MaybeCellExtension extensionT> >no setter - value → T
-
The cell's value
no setterinherited
-
values
→ ValueCell<
Iterable< V> > -
Available on ValueCell<
Returns a cell which evaluates to Map.values applied on the value in this cell.Map< , provided by the MapCellExtension extensionK, V> >no setter -
wait
→ ValueCell<
T> -
Available on FutureCell<
Return a cell that awaits the Future held inT> , provided by the WaitCellExtension extensionthis
.no setter -
waitLast
→ ValueCell<
T> -
Available on FutureCell<
A cell that awaits the Future held inT> , provided by the WaitCellExtension extensionthis
.no setter -
whenReady
→ ValueCell<
T> -
Available on ValueCell<
Create a cell that evaluates to ValueCell.none() while the cell's value is uninitialized.T> , provided by the ErrorCellExtension extensionno setter
Methods
-
abs(
) → ValueCell< Duration> -
Available on ValueCell<
Returns a cell holding a Duration of the same length as this but positive, see Duration.abs.Duration> , provided by the DurationCellExtension extension -
abs(
) → ValueCell< num> -
Available on ValueCell<
num> , provided by the NumericExtension extension -
addObserver(
CellObserver observer) → void -
Register an observer of the cell to be called when the cell's value changes.
override
-
and(
ValueCell< bool> other) → ValueCell<bool> -
Available on ValueCell<
Create a new cell which is the logical and ofbool> , provided by the BoolCellExtension extensionthis
andother
. -
apply<
U> (U fn(T value), {dynamic key}) → ValueCell< U> -
Available on ValueCell<
Create a new cell, with a value which is computed by applying a function on this cell's valueT> , provided by the ComputeExtension extension -
call(
) → T -
Retrieve the value of the cell.
inherited
-
cast<
R> () → ValueCell< Iterable< R> > -
Available on ValueCell<
Returns a cell which evaluates to Iterable.cast<R>() applied on the value in this cell.Iterable< , provided by the IterableCellExtension extensionT> > -
cast<
R> () → ValueCell< List< R> > -
Available on ValueCell<
Returns a cell which evaluates to List.cast<R>() applied on the value in this cell.List< , provided by the ListCellExtension extensionT> > -
chain(
void action(), {dynamic key}) → ActionCell -
Available on ValueCell<
Create an action cell that is chained to this cell.void> , provided by the ActionCellExtension extension -
coalesce(
ValueCell< T> ifNull) → ValueCell<T> -
Available on ValueCell<
Replace null values in this cell with value of another cell.T?> , provided by the NullCheckExtension extension -
contains(
ValueCell elem) → ValueCell< bool> -
Available on ValueCell<
Returns a cell that evaluates to true if the Set containsSet< , provided by the SetCellExtension extensionT> >elem
. -
containsAll(
ValueCell< Iterable> elems) → ValueCell<bool> -
Available on ValueCell<
Returns a cell that evaluates to true if the Set containsSet< , provided by the SetCellExtension extensionT> >elems
. -
containsKey(
ValueCell key) → ValueCell< bool> -
Available on ValueCell<
Returns a cell which evaluates to true if the Map held in this cell contains the keyMap< , provided by the MapCellExtension extensionK, V> >key
. -
containsValue(
ValueCell val) → ValueCell< bool> -
Available on ValueCell<
Returns a cell which evaluates to true if the Map held in this cell contains the valueMap< , provided by the MapCellExtension extensionK, V> >val
. -
createState(
) → CellState< StatefulCell> - Create the CellState for this cell.
-
delayed(
Duration delay) → FutureCell< T> -
Available on ValueCell<
Create a cell which notifies its observers, for value changes inT> , provided by the DelayCellExtension extensionthis
, after a delay. -
effect<
T> (T fn(), {dynamic key}) → ValueCell< T> -
Available on ValueCell<
Create a cell with a side effect that is run whenever this cell is triggered..void> , provided by the ActionCellEffectExtension extension -
eq<
U> (ValueCell< U> other) → ValueCell<bool> -
Returns a new ValueCell which compares the value of this cell to another cell for equality.
inherited
-
error<
E extends Object> ({bool all = false}) → ValueCell< E?> -
Available on ValueCell<
Create a cell which captures exceptions thrown during the computation of this cell.T> , provided by the ErrorCellExtension extension -
hold(
) → CellHolder -
Available on ValueCell, provided by the CellHolderExtension extension
Ensure that this cell is active. -
initialValue(
ValueCell< T> value) → ValueCell<T> -
Available on ValueCell<
Returns a cell that evaluates to the value ofT> , provided by the ErrorCellExtension extensionvalue
when the value of this is uninitialized. -
loadingValue(
ValueCell< T> value) → ValueCell<T> -
Available on ValueCell<
Returns a cell that evaluates to the value ofT> , provided by the ErrorCellExtension extensionvalue
while an async value is loading.. -
map<
E> (E toElement(T e)) → ValueCell< Iterable< E> > -
Available on ValueCell<
Returns a cell which evaluates to Iterable.map() applied on the value in this cell.Iterable< , provided by the IterableCellExtension extensionT> > -
mapCells<
E> (E fn(T e)) → ValueCell< Iterable< ValueCell< >E> > -
Available on ValueCell<
Apply a function on the value of every cell in cellList.List< , provided by the ListCellExtension extensionT> > -
mutableApply<
U> (U fn(T), void reverse(U), {dynamic key, bool changesOnly = false}) → MutableCell< U> -
Available on ValueCell<
Create a new mutable cell, with a value that is a function of this cell's value.T> , provided by the ComputeExtension extension -
neq<
U> (ValueCell< U> other) → ValueCell<bool> -
Returns a new ValueCell which compares the value of this cell to another cell for inequality.
inherited
-
nextValue(
) → Future< T> -
Available on ValueCell<
Returns a Future that completes with the next value of this cell, when it is updated.T> , provided by the ValueChangeExtension extension -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
not(
) → ValueCell< bool> -
Available on ValueCell<
Create a new cell which is the logical not ofbool> , provided by the BoolCellExtension extensionthis
. -
observe(
) → void -
Track this cell as an argument of the current compute/watch function.
inherited
-
onError<
E extends Object> (ValueCell< T> other) → ValueCell<T> -
Available on ValueCell<
Create a cell which handles exceptions thrown while computing the value ofT> , provided by the ErrorCellExtension extensionthis
. -
or(
ValueCell< bool> other) → ValueCell<bool> -
Available on ValueCell<
Create a new cell which is the logical or ofbool> , provided by the BoolCellExtension extensionthis
andother
. -
remainder(
ValueCell< num> other) → ValueCell<num> -
Available on ValueCell<
num> , provided by the NumericExtension extension -
removeObserver(
CellObserver observer) → void -
Remove an observer that was previously registered with addObserver.
override
-
select<
T> (ValueCell< T> ifTrue, [ValueCell<T> ? ifFalse]) → ValueCell<T> -
Available on ValueCell<
Create a new cell which selects between the values of two cells based onbool> , provided by the BoolCellExtension extensionthis
. -
store(
{bool changesOnly = false}) → StoreCell< T> -
Available on ValueCell<
Return a ValueCell which stores the value of this cell in memory.T> , provided by the StoreCellExtension extension -
toList(
) → ValueCell< List< T> > -
Available on ValueCell<
Returns a cell which evaluates to Iterable.toList applied on the value in this cell.Iterable< , provided by the IterableCellExtension extensionT> > -
toSet(
) → ValueCell< Set< T> > -
Available on ValueCell<
Returns a cell which evaluates to Iterable.toSet applied on the value in this cell.Iterable< , provided by the IterableCellExtension extensionT> > -
toString(
) → String -
A string representation of this object.
inherited
-
transform<
U extends T> () → ValueCell< U> -
Available on ValueCell<
T> , provided by the TransformExtension extension -
untilFalse(
) → Future< void> -
Available on ValueCell<
Returns a Future that completes when the value of this cell is false.bool> , provided by the BoolValueChangeExtension extension -
untilTrue(
) → Future< void> -
Available on ValueCell<
Returns a Future that completes when the value of this cell is true.bool> , provided by the BoolValueChangeExtension extension -
untilValue<
U> (U value) → Future< void> -
Available on ValueCell<
Returns a Future that completes when the value of this cell equalsT> , provided by the ValueChangeExtension extensionvalue
.
Operators
-
operator %(
ValueCell< num> other) → ValueCell<num> -
Available on ValueCell<
num> , provided by the NumericExtension extension -
operator *(
ValueCell< num> factor) → ValueCell<Duration> -
Available on ValueCell<
Returns a cell which holds the multiplication ofDuration> , provided by the DurationCellExtension extensionthis
byfactor
. -
operator *(
ValueCell< num> other) → ValueCell<num> -
Available on ValueCell<
num> , provided by the NumericExtension extension -
operator +(
ValueCell< Duration> other) → ValueCell<Duration> -
Available on ValueCell<
Returns a cell which holds the sum ofDuration> , provided by the DurationCellExtension extensionthis
andother
. -
operator +(
ValueCell< num> other) → ValueCell<num> -
Available on ValueCell<
num> , provided by the NumericExtension extension -
operator -(
ValueCell< Duration> other) → ValueCell<Duration> -
Available on ValueCell<
Returns a cell which holds the subtraction ofDuration> , provided by the DurationCellExtension extensionother
fromthis
. -
operator -(
ValueCell< num> other) → ValueCell<num> -
Available on ValueCell<
num> , provided by the NumericExtension extension -
operator /(
ValueCell< num> other) → ValueCell<num> -
Available on ValueCell<
num> , provided by the NumericExtension extension -
operator <(
ValueCell< Duration> other) → ValueCell<bool> -
Available on ValueCell<
Returns a cell of which the value is true ifDuration> , provided by the DurationCellExtension extensionthis
is less thanother
-
operator <(
ValueCell< num> other) → ValueCell<bool> -
Available on ValueCell<
num> , provided by the NumericExtension extension -
operator <=(
ValueCell< Duration> other) → ValueCell<bool> -
Available on ValueCell<
Returns a cell of which the value is true ifDuration> , provided by the DurationCellExtension extensionthis
is less than or equal toother
-
operator <=(
ValueCell< num> other) → ValueCell<bool> -
Available on ValueCell<
num> , provided by the NumericExtension extension -
operator ==(
Object other) → bool -
The equality operator.
override
-
operator >(
ValueCell< Duration> other) → ValueCell<bool> -
Available on ValueCell<
Returns a cell of which the value is true ifDuration> , provided by the DurationCellExtension extensionthis
is greater thanother
-
operator >(
ValueCell< num> other) → ValueCell<bool> -
Available on ValueCell<
num> , provided by the NumericExtension extension -
operator >=(
ValueCell< Duration> other) → ValueCell<bool> -
Available on ValueCell<
Returns a cell of which the value is true ifDuration> , provided by the DurationCellExtension extensionthis
is greater than or equal toother
-
operator >=(
ValueCell< num> other) → ValueCell<bool> -
Available on ValueCell<
num> , provided by the NumericExtension extension -
operator [](
ValueCell< int> index) → ValueCell<T> -
Available on ValueCell<
Returns a cell with a value equal to the element atList< , provided by the ListCellExtension extensionT> >index
in the List held in this cell. -
operator [](
ValueCell key) → ValueCell< V?> -
Available on ValueCell<
Returns a cell which evaluates to the value of the entry with keyMap< , provided by the MapCellExtension extensionK, V> >key
. -
operator unary-(
) → ValueCell< Duration> -
Available on ValueCell<
Returns a cell which holds the negation ofDuration> , provided by the DurationCellExtension extensionthis
. -
operator unary-(
) → ValueCell< num> -
Available on ValueCell<
num> , provided by the NumericExtension extension -
operator ~/(
ValueCell< int> quotient) → ValueCell<Duration> -
Available on ValueCell<
Returns a cell which holds the division ofDuration> , provided by the DurationCellExtension extensionthis
byquotient
. -
operator ~/(
ValueCell< num> arg) → ValueCell<num> -
Available on ValueCell<
num> , provided by the NumericExtension extension