onStartupTask method

  1. @override
Future<void> onStartupTask()
override

Implementation

@override
Future<void> onStartupTask() async {
  await waitForFirebaseInit();
  await _initBox();
  FirebaseAuth.instance
      .authStateChanges()
      .map(_AuthState.of)
      .distinct()
      .asyncMap(_onAuthState)
      .listen((_) {});

  if (allowAnonymous) {
    await FirebaseAuth.instance.signInAnonymously();
  }

  PrecisionStopwatch p = PrecisionStopwatch.start();

  double _dl = 1;
  while (p.getMilliseconds() < 1000) {
    await Future.delayed(Duration(milliseconds: (_dl *= 1.1).round()));
    _dl += 80;

    if ($signedIn) {
      success("Caught Sign in after ${p.getMilliseconds()}ms");
      break;
    }
  }
}