LeagueOfApi constructor

LeagueOfApi(
  1. String _apiKey, {
  2. Dio? client,
  3. bool log = false,
})

Implementation

LeagueOfApi(this._apiKey, {Dio? client, bool log = false}) {
  if (client != null) {
    _client = client;
  } else {
    _client = Dio(BaseOptions(
      connectTimeout: _CONNECT_TIMEOUT,
      receiveTimeout: _RECEIVE_TIMEOUT,
      sendTimeout: _SEND_TIMEOUT,
    ));

    _client.interceptors.add(RiotTokenApiInjector(_apiKey));

// fixme: uncomment when PrettyDioLogger become compatible with dio v4
//      if (log) {
//        _client.interceptors.add(PrettyDioLogger(
//            requestHeader: true,
//            requestBody: true,
//            responseBody: true,
//            responseHeader: false,
//            error: true,
//            compact: true,
//            maxWidth: 90));
//      }

    accountV1Service = AccountV1Service(_client);
    summonerService = SummonerV4Service(_client);
    leagueService = LeagueV4Service(_client);
  }
}