init method

Future<bool> init(
  1. bool handleSessionAutomatically
)

Initializes the client by authorizing the user with the constructor supplied UserDetails

Must be called on every instance of ValorantClient to send authorized requests from the instance.

Implementation

Future<bool> init(bool handleSessionAutomatically) async {
  if (_rsoHandler._isLoggedIn) {
    return true;
  }

  _cookieJar = shouldPersistSession ? PersistCookieJar() : CookieJar();
  _client.interceptors.add(CookieManager(_cookieJar));

  if (!await _rsoHandler.authenticate(handleSessionAutomatically)) {
    callback.invokeErrorCallback('Authentication Failed.');
    return false;
  }

  return _isInitialized = true;
}