settleAnimations static method
Waits for the next frame, then for running animations, like a theme
fading in, to finish, for at most timeout.
Implementation
static Future<void> settleAnimations({
Duration timeout = const Duration(seconds: 1),
}) async {
final Stopwatch stopwatch = Stopwatch()..start();
await _nextFrame();
while (SchedulerBinding.instance.transientCallbackCount > 0 &&
stopwatch.elapsed < timeout) {
await _nextFrame();
}
}