tryRestoreAuth method

  1. @override
Future<bool> tryRestoreAuth({
  1. bool retryWhenTimeout = false,
  2. required VoidCallback onUserStateChanged,
})
override

Running the application at startup will automatically re-authenticate the user.

If the user has already logged in before exiting the application, the user is automatically logged in based on the authentication information recorded in the application.

If retryWhenTimeout is true, retries are attempted even if the authentication times out.

Execute onUserStateChanged when a user's authentication state is changed.

アプリ起動時に実行することで自動的に再認証を行ないます。

アプリ終了前にすでにログインしていた場合、アプリ内に記録されている認証情報を元に自動的にログインを行います。

retryWhenTimeouttrueになっている場合、認証がタイムアウトした場合でもリトライを試みます。

ユーザーの認証状態が変更されたときにonUserStateChangedを実行します。

Implementation

@override
Future<bool> tryRestoreAuth({
  bool retryWhenTimeout = false,
  required VoidCallback onUserStateChanged,
}) async {
  final signedIn = await database.tryRestoreAuth();
  if (signedIn) {
    onUserStateChanged.call();
  }
  return signedIn;
}