pumpAndSettle method

Future<void> pumpAndSettle({
  1. Duration? timeout,
})

Pump the widget tree and wait for animations to complete.

Implementation

Future<void> pumpAndSettle({Duration? timeout}) async {
  final end = clock.now().add(timeout ?? const Duration(seconds: 10));
  do {
    if (clock.now().isAfter(end)) {
      throw Exception('pumpAndSettle timed out');
    }
    await pump();
  } while (_binding.hasScheduledFrame);
}