NhostClient constructor
- Subdomain? subdomain,
- ServiceUrls? serviceUrls,
- AuthStore? authStore,
- Duration? tokenRefreshInterval,
- Client? httpClientOverride,
Constructs a new Nhost client.
subdomain is the Nhost "subdomain" and "region" that can be found on your Nhost project page. for local development pass 'local' to subdomain and leave region empty string '';
region
is the Nhost services Urls that can be found on
your Nhost self-hosted 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({
this.subdomain,
this.serviceUrls,
AuthStore? authStore,
Duration? tokenRefreshInterval,
http.Client? httpClientOverride,
}) : _session = UserSession(),
_authStore = authStore ?? InMemoryAuthStore(),
_refreshInterval = tokenRefreshInterval,
_httpClient = httpClientOverride {
if ((subdomain == null && serviceUrls == null) ||
(subdomain != null && serviceUrls != null)) {
throw ArgumentError.notNull(
'You have to pass either [Subdomain] or [ServiceUrls]',
);
}
initializeLogging();
}