build method

  1. @override
Future<void> build()

Implementation

@override
Future<void> build() async {
  _isLoggedIn = ref.watch(
    currentUserProvider.select((value) {
      // If the currentUser is null, the auth sequence is not done yet.
      if (value == null) return null;
      // If the currentUser is not null, but the uid is null, the user is not logged in.
      // If the currentUser is not null and the uid is not null, the user is logged in.
      return value.uid != null;
    }),
  );

  _notificationRedirectPath =
      ref.watch(notificationRedirectProvider).asData?.value;

  ref.listenSelf((_, __) {
    // This callback is called everytime this provider changes, which is every
    // time any of the providers it watches above changes.
    if (state.isLoading) return;

    _routerListener?.call();
  });
}