Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing in contextual params #49

Closed
seenickcode opened this issue May 22, 2018 · 2 comments
Closed

Passing in contextual params #49

seenickcode opened this issue May 22, 2018 · 2 comments
Labels
enhancement Suggested feature or enhancement to the library.

Comments

@seenickcode
Copy link

seenickcode commented May 22, 2018

Hello there,

I have a class that I'd like to navigate to, defined by a Flurio handler, like so:

...
myFluroRouter.define('/foobars/:id/edit', handler: new Handler(
        handlerFunc: (BuildContext context, Map<String, dynamic> params) {
      final String id = params['id']?.first;

      return new FoobarEdit(new Key(id), int.parse(id));
    }));

What I'd like to do now is be able to pass in a callback to FoobarEdit. This callback is contextual and depends on the class that is invoking the constructor for this class, like so:

...
myFluroRouter.define('/foobars/:id/edit', handler: new Handler(
       handlerFunc: (BuildContext context, Map<String, dynamic> params) {
     final String id = params['id']?.first;

     return new FoobarEdit(new Key(id), int.parse(id), myFoobarCallbackFunc);
   }));

What do you think the best approach for this is? It seems like for now, I'm forced to use the traditional
Flutter Navigate class like so:

Navigator.push(
        context, new MaterialPageRoute(builder: (context) => new FoobarEdit(...));

Is there a better way to do this?

@lukef lukef added the enhancement Suggested feature or enhancement to the library. label Sep 17, 2018
@lukef lukef added this to the 2.0.0 milestone Dec 21, 2018
@lukepighetti
Copy link
Owner

You can now pass custom RouteSettings with arguments acfa580

@lukepighetti
Copy link
Owner

Wow, I totally did not triage this properly. @seenickcode is this something you're still looking for? Feel free to reopen if it is.

@lukepighetti lukepighetti removed this from the 2.0.0 milestone Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Suggested feature or enhancement to the library.
Projects
None yet
Development

No branches or pull requests

3 participants