signInOffline method

  1. @override
Future<GoogleSignInCredentials?> signInOffline()
override

Use this to sign in using the access_token from the cache or internal storage. Therefore, can also be used to check if th user is already logged in or not.

For Mobile and Web devices, this is the same as signInOnline, while it firsts check for an already existing token, and if not exists then perform the sign in online.

Implementation

@override
Future<GoogleSignInCredentials?> signInOffline() async {
  final credsJsonString = await params.retrieveAccessToken.call();
  if (credsJsonString == null) return null;

  try {
    final credsJson =
        Map<String, dynamic>.from(jsonDecode(credsJsonString) as Map);
    _setCredentials(GoogleSignInCredentials.fromJson(credsJson));
    return _credentials!;
  } catch (err) {
    log('$err', name: _kLogName);
    return null;
  }
}