lucavenir / go_router_riverpod

An example on how to use Riverpod + GoRouter
460 stars 68 forks source link

Complete firebase example #31

Open lucavenir opened 1 year ago

lucavenir commented 1 year ago

The firebase folder should receive some more love. Codegen, new APIs, stuff like that.

yeasir-bjit commented 7 months ago
lass AppWithFirebase extends ConsumerWidget {
  const AppWithFirebase({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final router = ref.watch(routerProvider);

    return MaterialApp.router(
      routeInformationParser: router.routeInformationParser,
      routerDelegate: router.routerDelegate,
      routeInformationProvider: router.routeInformationProvider,
      title: 'flutter_riverpod + go_router Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
    );
  }
}

final router = ref.watch(routerProvider); This will rebuild whole material app every route change or rebuild the router, does it legit?

lucavenir commented 7 months ago

As of now, yes, the firebase_example folder contains legacy code. As you've pointed out the current code is less than ideal. Please refrain from reading that example. You can easily apply firebase-wise considerations with the main example