pump method

Future<void> pump({
  1. Duration? duration,
})

Pump the widget tree for the given duration.

If duration is null, it will pump for a single frame.

Implementation

Future<void> pump({Duration? duration}) async {
  if (duration == null) {
    return _binding.endOfFrame;
  }

  final end = clock.now().add(duration);
  while (clock.now().isBefore(end)) {
    await _binding.endOfFrame;
  }
}