pump method

Future<void> pump({
  1. Duration? duration,
  2. EnginePhase phase = EnginePhase.sendSemanticsUpdate,
  3. required String label,
})

Advances a frame after yielding live work, preserving the guarded frame boundary required by route transitions and overlay updates.

Implementation

Future<void> pump({
  Duration? duration,
  EnginePhase phase = EnginePhase.sendSemanticsUpdate,
  required String label,
}) async {
  // LiveTestWidgetsFlutterBinding.pump(duration) delays and builds in the
  // same turn. A separate yield avoids racing navigation callbacks with the
  // next build. The label is part of the benchmark contract.
  if (duration != null && duration > Duration.zero) {
    await liveDelay(duration);
    await tester.pump(null, phase);
    await tester.pump(null, phase);
  } else {
    await tester.pump(duration, phase);
  }
  await _drainFlutterDiagnostics();
}