logIn method

Future<void> logIn({
  1. String? email,
  2. Map<String, String>? additionalParameters,
})

Log in and set the resulting user as the current user.

Implementation

Future<void> logIn({
  String? email,
  Map<String, String>? additionalParameters,
}) async {
  if (_logOutFuture != null) await _logOutFuture;
  if (_tokenFuture != null) await _tokenFuture;

  _logInFuture ??= _runOrHandleTokenError(
    () => client
        .logIn(email: email, additionalParameters: additionalParameters)
        .then(persistence.setCurrentUser),
  ).whenComplete(() => _logInFuture = null);

  return _logInFuture!;
}