signIn method

  1. @override
Future signIn({
  1. bool reAuthenticate = false,
  2. bool suppressErrors = true,
  3. bool silentOnly = false,
})
  • Throw if sign in failed

Implementation

@override
Future signIn({
  bool reAuthenticate = false,
  bool suppressErrors = true,
  bool silentOnly = false,
}) async {
  var debugPrefix = '$runtimeType.signIn()';
  lazy.log(debugPrefix, forced: debugLog);

  try {
    lazy.log('$debugPrefix:_api.signInSilently()', forced: debugLog);
    await _api
        .signInSilently(
            reAuthenticate: reAuthenticate, suppressErrors: suppressErrors)
        .onError((e, _) => throw ('_api.signInSilently():$e'));

    // Sign-in silently failed -> try pop-up
    if (_api.currentUser == null && !silentOnly) {
      lazy.log('$debugPrefix:_api.signIn()', forced: debugLog);
      await _api.signIn().onError((e, _) => throw ('_api.signIn():$e'));
    }
  } catch (e) {
    throw '$debugPrefix:catch:$e';
  }
}