slovnicki / beamer

A routing package built on top of Router and Navigator's pages API, supporting arbitrary nested navigation, guards and more.
MIT License
591 stars 129 forks source link

[Q] BeamLocation - BeamerDelegate - RoutesLocationBuilder - routes #582

Open julienmiclo opened 2 years ago

julienmiclo commented 2 years ago

Hello, some one can help me? I can't find my answer in the documentation or in github issues.

I will try to explain my problem: I have a BeamerDelegate with RoutesLocationBuilder like this (3 routes):

BeamerDelegate(
    locationBuilder: RoutesLocationBuilder(
        routes: {
            '/folders': (context, state, data) => const Screen1(),
            '/folders/:folderID': (context, state, data) => const Screen2(folderID: state.pathParameters['folderID']),
            '/folders/images/:imageID': (context, state, data) => const Screen3(imageID: state.pathParameters['imageID']),
        }
    )
);

When i go on: /folders => screen1 OK /folders/3 => screen2 with folderID 3 OK /folders/images/2 => go on screen2 with folderID null NOT OK

I try to invert /folder/:folderID and /folders/images/:imageID but same result.

I have also a pathPatterns in a BeamLocation with

[
    '/home',
    '/folders',
    '/folders/:folderID',
    '/folders/images/:imageID',
]

If you need more example or code, tell me!

Thank you

alanlanglois commented 1 year ago

Maybe I don't get it, but shouldn't you use this path instead?

'/folders/:folderID/images/:imageID'