valueCell<V> method

ValueCell<V> valueCell<V>(
  1. Symbol id
)

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 id is not registered.
  • StateError when the registration is not a ValueCell<V> at all (either a plain Cell, or a ValueCell of a different value type).

See Also:

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;
}