pump method Null safety

  1. @override
Future<void> pump(
  1. [Duration? duration]
)
override

Called to indicate that there should be a new frame after an optional delay.

The frame is pumped after a delay of duration if duration is not null, or immediately otherwise.

This is invoked by flingFrom, for instance, so that the sequence of pointer events occurs over time.

The WidgetTester subclass implements this by deferring to the binding.

See also SchedulerBinding.endOfFrame, which returns a future that could be appropriate to return in the implementation of this method.

Implementation

@override
Future<void> pump([Duration? duration]) async {
  if (duration != null)
    await Future<void>.delayed(duration);
  binding.scheduleFrame();
  await binding.endOfFrame;
}