Skip to content

[go_router] It is impossible to control the parsing of a path of a route, which makes some use cases impossible to implement #172125

@mateusfccp

Description

@mateusfccp

Use case

I have a route where an object has multiple keys. There are more than one way to deal with it, but one of them is composing the key in the url, like ${key1}_${key2}.1

Currently, trying to implement this use case is not possible, because using path: '/resource/:key1_:key2' will parse it as two path parameters, key1_ and key2.

The documentation is not clear about the parsing details, simply stating that "to specify a path parameter, [you have to] prefix a path segment with a : character, followed by a unique name, for example, :userId".

Proposal

We should have a way to control this somehow, so that the aforementioned kind of URL is possible. One way of solving it is to allow passing a pathParser parameter that may be custom implemented to a GoRoute

Another way would be to have a way to delimit parameter identifiers in paths, for instance (straw man syntax), /resource/:{key1}_:key2.

There may be other possible approaches to this limitation.

Footnotes

  1. https://stackoverflow.com/questions/37628787/rest-api-uri-for-resource-with-multiple-primary-keys

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterp: go_routerThe go_router packagepackageflutter/packages repository. See also p: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework teamworkaround availableThere is a workaround available to overcome the issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions