flushPending method
Implementation
Future<void> flushPending() async {
// Drain until empty so screens recorded during an onScreenAdded callback
// are not lost.
Object? firstError;
StackTrace? firstStackTrace;
while (_pendingScreens.isNotEmpty) {
try {
await _flushPendingScreen();
} catch (error, stackTrace) {
firstError ??= error;
firstStackTrace ??= stackTrace;
}
}
if (firstError != null) {
Error.throwWithStackTrace(firstError, firstStackTrace!);
}
}