csells / go_router

The purpose of the go_router for Flutter is to use declarative routes to reduce complexity, regardless of the platform you're targeting (mobile, web, desktop), handling deep linking from Android, iOS and the web while still allowing an easy-to-use developer experience.
https://gorouter.dev
442 stars 96 forks source link

feat: add optional additional `hiddenParams` #73

Closed raulmabe closed 2 years ago

raulmabe commented 2 years ago

Related: #42

I am creating this PR in order to allow users pass optional complex data to routes. I have added extra optional parameters which won't be reflected to the URL, while allowing all extra capabilities of deep linking. (These params will be empty by default).

csells commented 2 years ago

I don't think we need any new code; this functionality can be implemented today by passing around object IDs and looking them up in the pageBuilder.

raulmabe commented 2 years ago

I agree both ways achieve the same result, but I think it can be useful to be able to do it this way too, as not every app uses global library instances as the examples do.

For example, in our enterprise, we use scoped blocs which are created inside each page. These blocs have the responsability to fetch the object according to the ID. Thus, in order to access this bloc from the pageBuilder we should do a big refactor and extract each page bloc in its corresponding pageBuilder, which I find unnecessary.

With this new way we could integrate the go_router as frictionless as possible, because it's more similar to the previous navigator API. Hence the utility of this new method.

raulmabe commented 2 years ago

For example, in our enterprise, we use scoped blocs which are created inside each page. These blocs have the responsability to fetch the object according to the ID. Thus, in order to access this bloc from the pageBuilder we should do a big refactor and extract each page bloc in its corresponding pageBuilder, which I find unnecessary.

That's my specific use case, but I think including this feature will add flexibility to the developer (thus reducing complexity) while allowing deep linking. Additionally, it really fits with the package description.

The purpose of the go_router is to use declarative routes to reduce complexity, regardless of the platform you're targeting (mobile, web, desktop), handling deep linking from Android, iOS and the web while still allowing an easy-to-use developer experience.

csells commented 2 years ago

your argument about similarity to nav1 is compelling. I've created a bug to track this request (I wasn't quite sold on your PR): https://github.com/csells/go_router/issues/81

raulmabe commented 2 years ago

I wasn't quite sold on your PR

Yea, I should have exposed my arguments before.

I've created a bug to track this request

Cool then :smile: