So, I'm using the auto_route package for navigation in my app and flutter_bloc
for state management. When I was using the old Navigator, I could just wrap a route with a BlocProvider. For example:
class Router {
static Route<dynamic> generateRoute(RouteSettings settings) {
switch (settings.name) {
case '/':
return MaterialPageRoute(
builder: (_) => BlocProvider( // wrapped Home with BlocProvider
create: (context) => SubjectBloc(),
child: Home(),
),
);
case '/feed':
return MaterialPageRoute(builder: (_) => Feed());
}
}
}
Now, auto_route uses annotations to generate a routing file. How would I go around providing provider context to the route?