registerAuthClientService function

void registerAuthClientService(
  1. Client client, {
  2. bool close = true,
})

Registers the http.Client object within the current service scope.

The provided client object will be available via the top-level authenticatedHttp getter.

Calling this function outside of a service scope will result in an error. Calling this function more than once inside the same service scope is not allowed.

Implementation

void registerAuthClientService(http.Client client, {bool close = true}) {
  ss.register(_authenticatedClientKey, client);
  if (close) {
    ss.registerScopeExitCallback(() {
      client.close();
      return null;
    });
  }
}