flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
161.86k stars 26.57k forks source link

[go_router] [WEB] pathParameters not working with deeplink #145942

Closed Fraa-124 closed 3 weeks ago

Fraa-124 commented 1 month ago

Steps to reproduce

...,

GoRoute(
        path: '/tag/:param1',
        builder: (context, state) {
          final term = state.pathParameters['param1'].toString();
          return CustomPage();
        },
      ),
// this is not working neither, not a path param
   GoRoute(
        path: '/tag/demo',
        builder: (context, state) {
          return CustomPage();
        },
      )
...

Now in a browser, setting the url as https://example.com/tag/param1 or https://example.com/tag/demo

The requested route name was: "/tag/param1"
There was no corresponding route in the app, and therefore the initial route specified will be
ignored and "/" will be used instead.
The requested route name was: "/tag/demo"
There was no corresponding route in the app, and therefore the initial route specified will be
ignored and "/" will be used instead.

Expected results

The page is loaded despite the url has pathParams or not.

Actual results

An error is presented.

The requested route name was: "/tag/param1"
There was no corresponding route in the app, and therefore the initial route specified will be
ignored and "/" will be used instead.

Version 13.2.2

Code sample

Code sample ```dart [Paste your code here] ```

Screenshots or Video

Screenshots / Video demonstration [Upload media here]

Logs

No response

Flutter Doctor output

Doctor output ```console The requested route name was: "/tag/param1" There was no corresponding route in the app, and therefore the initial route specified will be ignored and "/" will be used instead. ```
huycozy commented 1 month ago

Hi @Fraa-124 Could you share a complete & minimal sample code? And please also share the output of flutter doctor -v.

I checked this issue using package sample code but couldn't reproduce it. You can also try it and confirm if it works or not.

Fraa-124 commented 3 weeks ago

You are right, thank you.

github-actions[bot] commented 1 week ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.