close method

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

Stops accepting callbacks, drains admitted work, then closes the handle.

Implementation

@override
Future<void> close() {
  if (Zone.current[_callbackZone] != null) {
    return Future.error(
      StateError('Cannot close the driver in its callback.'),
    );
  }
  if (_closeFuture case final future?) return future;
  _closing = true;
  return _closeFuture = _tail.then((_) => _database.close());
}