idle method Null safety

  1. @override
Future<void> idle()
override

Acts as if the application went idle.

Runs all remaining microtasks, including those scheduled as a result of running them, until there are no more microtasks scheduled. Then, runs any previously scheduled timers with zero time, and completes the returned future.

May result in an infinite loop or run out of memory if microtasks continue to recursively schedule new microtasks. Will not run any timers scheduled after this method was invoked, even if they are zero-time timers.

Implementation

@override
Future<void> idle() {
  assert(inTest);
  final Future<void> result = super.idle();
  _currentFakeAsync!.elapse(Duration.zero);
  return result;
}