Reputation: 28986
I'm using go_router_builder
to build routes. Here's one:
@TypedGoRoute<HomeRoute>(
path: '/',
)
class HomeRoute extends GoRouteData {
final Foo? $extra;
HomeRoute([this.$extra]);
@override
Widget build(BuildContext context, GoRouterState state) {
return HomeScreen();
}
}
Now the problem is I can't figure out a way to pass the Foo
object to HomeRoute
in the code.
Upvotes: 2
Views: 724
Reputation: 1
You can send your object if you write like below code.
void _tap() => HomeRoute(Foo(id: 1)).go(context);
https://docs.page/csells/go_router/typed-routing#extra-parameter
Upvotes: 0