flutterdartflutter-go-router

Path matching with go_router


I can't figure out path matching with go router.

GoRoute(
    path: 'something/:id',
    pageBuilder: (context, state) => NoTransitionPage(
        key: UniqueKey(),
        child: SomeWidget(id: state.pathParameters['id']!)))

If I try to open example.com/something/some-random-id I get a no routes for location exception. I have a route for just something and that works, so deep linking works, it's just not matching for links with parameters.

Maybe I'm missing something, but the guides I have found don't really explain path matching.


Solution

  • I just needed to add a / in front of the path like this /something/:id