0

I want to use flutter_riverpods and go_router in my app to manage the state of the bottomNavigationBar and enable signing out of the whole app from the settings page which is in the bottomNavigationBar. How can I integrate ProviderScope in the app? The main function looks like this:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  await UserDataPreferences.init();

  runApp(
    MultiProvider(
      providers: [
        ChangeNotifierProvider(create: (_) => ThemeProvider()),
        ChangeNotifierProvider(create: (_) => UserDataProvider()),
        ChangeNotifierProvider(create: (_) => SelectedBusSeats()),
        ChangeNotifierProvider(create: (_) => ApplicationState()),
        Provider(create: (_) => BusServices()),
      ],
      child: const MyApp(),
    ),
  );
}

I wrapped MultiProver with the ProviderScope and it didn't work. I also wrapped MyApp with ProviderScope, while both are inside MultiProvider, and this didn't work either.

  • 1
    MultiProvider is for provider package. not for riverpod..if you wanna use riverpod, remove that multiProvider and wrap your MyApp with ProviderScope. – john Oct 27 '22 at 13:47
  • Indeed. The RiverPod way of combining Providers is far more elegant and compact and flexible. Buhbye, MultiProvider! – Randal Schwartz Oct 27 '22 at 18:17

0 Answers0