close method

  1. @override
Future<void> close()
override

Closes the backend. Idempotent.

Implementation

@override
Future<void> close() async {
  if (_closed) return;
  _closed = true;
  _owner = null;
  final here = location;
  // NOTE: the claim is held until the backend has closed; releasing it first
  // lets a concurrent attach() open a backend over one still being torn down.
  try {
    await closeBackend();
  } finally {
    if (identical(_openByLocation[here], this)) _openByLocation.remove(here);
  }
}