logout method

Future<void> logout()

Logs out and releases the user, and destroys the underlying JWT.

Implementation

Future<void> logout() async {
  if (!config.cognitoEnabled) {
    throw StateError('Cannot logout with Cognito disabled.');
  }

  if (_user != null) {
    await _user!.signOut();
    _user = null;
  }
  _authCode = null;
  _authToken = null;
}