close method Null safety

  1. @override
Future close(
  1. {bool force = false}
)
override

Closes any HTTP Client resources.

If force is false (the default) the Client will be kept alive until all active connections are done. If force is true any active connections will be closed to immediately release all resources (subject to platform support).

Implementation

@override
Future close({bool force = false}) async {
  _isClosing = true;
  expireCurrent();
  _cleanupTimer?.cancel();
  _cleanupTimer = null;
  await _cleanupPastClients(force);
  if (_current != null) {
    await _closeClientFn(_current!._client, force);
  }
}