close method

Future<void> close({
  1. bool closeExternal = true,
})

Closes the client and cleans up any resources associated with it.

It's important to close each client when it's done being used; failing to do so can cause the Dart process to hang.

Implementation

Future<void> close({bool closeExternal = true}) async {
  final client = await _client;
  if (client == null) return;
  if (_externalClient == null || closeExternal) {
    client.close();
    _client = null;
  }
}