pumpWithCells method

Future<void> pumpWithCells({
  1. required Map<Symbol, Cell> cells,
  2. required Widget child,
  3. Widget wrapper(
    1. Widget child
    )?,
})

Pumps child inside a CellScope pre-populated with cells.

Wraps child in wrapper if supplied; otherwise in a default MaterialApp(home: Scaffold(body: child)). The CellScope is installed outside the wrapper, so widgets built by the wrapper can also resolve cells through CellScope.

Parameters:

  • cells: The Registration Map. Symbol-keyed cells placed in the CellScope installed above child. Use the same Symbols the widget under test will look up via CellScope.of / CellScope.valueOf.
  • child: The Widget Under Test. Placed inside wrapper and beneath the CellScope.
  • wrapper: Optional Tree Override. A function that takes the child and returns the widget to place inside the CellScope. Useful for supplying a navigatorKey, a specific theme, or a router. When omitted, the default MaterialApp(home: Scaffold(body: child)) is used.

Returns:

The Future from WidgetTester.pumpWidget — resolves once the first frame has been built.

See Also:

Implementation

Future<void> pumpWithCells({
  required Map<Symbol, Cell> cells,
  required Widget child,
  Widget Function(Widget child)? wrapper,
}) {
  final wrapped = wrapper != null
      ? wrapper(child)
      : MaterialApp(home: Scaffold(body: child));
  return pumpWidget(CellScope(cells: cells, child: wrapped));
}