2

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.

iDecode
  • 22,623
  • 19
  • 99
  • 186

1 Answers1

0

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