valueCell<V> method
Returns the ValueCell<V> registered at id.
This is the common lookup for emitAndSettle and for any test that wants to read the current value directly.
Parameters:
id: The Registration Key.
Returns:
The registered cell, statically typed as ValueCell<V>.
Throws:
- StateError when
idis not registered. - StateError when the registration is not a
ValueCell<V>at all (either a plain Cell, or aValueCellof a different value type).
See Also:
- cell — the un-narrowed variant.
- CellScope.valueOf — the production equivalent.
Implementation
ValueCell<V> valueCell<V>(Symbol id) {
final c = _cells[id];
if (c == null) {
throw StateError('CellTestHarness: no cell registered at $id.');
}
if (c is! ValueCell<V>) {
throw StateError(
'CellTestHarness: $id is ${c.runtimeType}, not ValueCell<$V>.',
);
}
return c;
}