pumpWithCells method
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 abovechild. Use the sameSymbols the widget under test will look up via CellScope.of / CellScope.valueOf.child: The Widget Under Test. Placed insidewrapperand beneath the CellScope.wrapper: Optional Tree Override. A function that takes thechildand returns the widget to place inside the CellScope. Useful for supplying anavigatorKey, a specific theme, or a router. When omitted, the defaultMaterialApp(home: Scaffold(body: child))is used.
Returns:
The Future from WidgetTester.pumpWidget — resolves once the first frame has been built.
See Also:
- CellPumpWithCells — the extension-level docs, including the
rationale for placing the CellScope outside the
wrapper. - CellScope — the registry installed above the tree.
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));
}