Client constructor Null safety
- Credentials _credentials,
- {String? identifier,
- String? secret,
- CredentialsRefreshedCallback? onCredentialsRefreshed,
- bool basicAuth = true,
- Client? httpClient}
Creates a new client from a pre-existing set of credentials.
When authorizing a client for the first time, you should use AuthorizationCodeGrant or resourceOwnerPasswordGrant instead of constructing a Client directly.
httpClient
is the underlying client that this forwards requests to after
adding authorization credentials to them.
Throws an ArgumentError if secret is passed without identifier.
Implementation
Client(this._credentials,
{this.identifier,
this.secret,
CredentialsRefreshedCallback? onCredentialsRefreshed,
bool basicAuth = true,
http.Client? httpClient})
: _basicAuth = basicAuth,
_onCredentialsRefreshed = onCredentialsRefreshed,
_httpClient = httpClient ?? http.Client() {
if (identifier == null && secret != null) {
throw ArgumentError('secret may not be passed without identifier.');
}
}