Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Isn't working with navigatorKey on MaterialApp (hangs on ConnectionState.waiting) #22

Closed
scullabyte opened this issue Apr 23, 2020 · 2 comments

Comments

@scullabyte
Copy link

I am using a navigatorKey inside my MaterialApp constructor on my main.dart page. Every time I load the app I see the userSnapshot is passed to the AuthWidget with the ConnectionState.waiting, however, when I debug the StreamBuilder inside AuthWidgetBuilder I am seeing the snapshot sent with the correct user, then somehow the navigatorKey

Here is my code in the main.dart file:

        child: MultiProvider(
          providers: [
            Provider<FirebaseAuthService>(
              create: config.authServiceBuilder,
            ),
            Provider.value(value: locator<NavigationService>()),
          ],
          child: AuthWidgetBuilder(
            databaseBuilder: config.databaseBuilder,
            builder: (BuildContext context, AsyncSnapshot<User> userSnapshot) {
              return MaterialApp(
                navigatorKey:
                    Provider.of<NavigationService>(context).navigationKey,
                home: AuthWidget(userSnapshot: userSnapshot),

I've also tried to inject the service with get-it. Any help would be very much appreciated.

@enri90
Copy link

enri90 commented Jul 5, 2020

Provider<NavigationService>( create: (_) => NavigationService(), ),

navigatorKey: NavigationService().navigatorKey,

how can we totally implement it as a provider without get-it doesn't work for me?

@bizz84
Copy link
Owner

bizz84 commented Jan 7, 2023

This project now uses Riverpod.

Closing following changes in #94.

Feel free to open new issues if needed.

@bizz84 bizz84 closed this as completed Jan 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants