waitForDialogToClose method
Implementation
Future waitForDialogToClose() {
if (!snackBarObserver.isDialog || snackBarObserver.navigator == null) {
return Future.value();
}
var completer = Completer();
late VoidCallback fn;
fn = () {
if (!snackBarObserver.isDialog && !completer.isCompleted) {
completer.complete();
snackBarObserver._currentRoute.removeListener(fn);
}
};
snackBarObserver._currentRoute.addListener(fn);
return completer.future;
}