waitDestroyed method

Future<bool> waitDestroyed({
  1. Duration? timeout,
})

Waits for this window to be destroyed.

  • If timeout is defined it will return false on timeout.

Implementation

Future<bool> waitDestroyed({Duration? timeout}) {
  if (_destroyed) return Future.value(true);

  var waitingDestroyed = _waitingDestroyed ??= Completer();

  var future = waitingDestroyed.future;

  if (timeout != null) {
    future = future.timeout(timeout, onTimeout: () => false);
  }

  return future;
}