close method

Future<void> close()

Closes child scopes and then this scope, attempting every cleanup callback.

Resolution stops immediately. Repeated calls return the same future.

Implementation

Future<void> close() {
  if (_closing != null) return _closing!;
  _markClosed();
  final completer = Completer<void>();
  _closing = completer.future;
  unawaited(_releaseAll()
      .then(completer.complete, onError: completer.completeError));
  return _closing!;
}