PubClient constructor

PubClient({
  1. String? pubUrl,
  2. Credentials? credentials,
  3. Client? client,
  4. bool debug = false,
  5. String? userAgent,
})

Implementation

PubClient({
  this.pubUrl,
  Credentials? credentials,
  http.Client? client,
  this.debug = false,
  String? userAgent,
}) : endpoint = Endpoint(pubUrl) {
  http.Client httpClient;
  if (credentials == null) {
    httpClient = http.Client();
  } else {
    httpClient = Client(
      credentials,
      identifier: PubAuth.identifier,
      secret: PubAuth.secret,
    );
  }

  userAgent ??= 'default';

  _headers = {
    'user-agent': 'pub_api_client/$packageVersion ($userAgent)',
  };
  _client = client ?? httpClient;
}