NhostClient constructor

NhostClient({
  1. required String backendUrl,
  2. AuthStore? authStore,
  3. Duration? tokenRefreshInterval,
  4. Client? httpClientOverride,
})

Constructs a new Nhost client.

backendUrl is the Nhost "Backend URL" that can be found on your Nhost project page.

authStore (optional) is used to persist authentication tokens between restarts of your app. If not provided, the tokens will not be persisted.

tokenRefreshInterval (optional) is the amount of time the client will wait between refreshing its authentication tokens. If not provided, will default to a value provided by the server.

httpClientOverride (optional) can be provided in order to customize the requests made by the Nhost APIs, which can be useful for proxy configuration and debugging.

Implementation

NhostClient({
  required this.backendUrl,
  AuthStore? authStore,
  Duration? tokenRefreshInterval,
  http.Client? httpClientOverride,
})  : _session = UserSession(),
      _authStore = authStore ?? InMemoryAuthStore(),
      _refreshInterval = tokenRefreshInterval,
      _httpClient = httpClientOverride {
  initializeLogging();
}