waitForPopupRouteToClose method

Future waitForPopupRouteToClose()

Implementation

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