expectCellValue<V> method

void expectCellValue<V>(
  1. ValueCell<V> cell,
  2. Object? matcher, {
  3. String? reason,
})

Asserts that cell's current value matches matcher.

Sugar over expect(cell.value, matcher) with a diagnostic reason that names the cell. Throws TestFailure on mismatch.

Parameters:

  • cell: The Asserted Cell. Must be a ValueCell — the helper reads .value synchronously. For plain Cell sources, assert on a recorded pulse sequence or a rendered widget instead.
  • matcher: The Expected Value. Any matcher accepted by expect — a literal value, isA<T>(), predicate(...), and so on.
  • reason: Optional Failure Context. If supplied, it replaces the default reason; otherwise the default reason names the cell's runtime type. Supply it when the test has more than one cell of the same value type, so the failure message identifies which one.

Throws:

TestFailure — the same failure type expect raises — when cell's current value does not match matcher. The reason attached to the failure is reason when supplied; otherwise 'for cell ${cell.runtimeType}'.

See Also:

  • CellExpectValue — the extension-level docs, including the diagnostic rationale.
  • expect — the underlying matcher call.

Implementation

void expectCellValue<V>(
  ValueCell<V> cell,
  Object? matcher, {
  String? reason,
}) {
  expect(
    cell.value,
    matcher,
    reason: reason ?? 'for cell ${cell.runtimeType}',
  );
}