skip to Main Content

I am stuck in navigation. I want to pass the function/Method as argument. I tried to find the solution but I did not get anything. I used go_router package for navigation.

I want to pass a function from screen A and I was called that function from the button click on B Screen if the user can click that button on screen B. In that case, I want to perform some operations on screen A.

Any Suggestion is appreciatable I am open to suggestions if there is any other good way to achieve the same.

2

Answers


  1. I think this is a bad idea and it is better to use a provider to store functions and variables, which will be accessible through the context anywhere in the application, and register this provider higher up the tree, above A and B

    Login or Signup to reply.
  2. It’s a bad idea to pass the method , you can use state management BLoC and use BlocProvider.of then you will be able to use the button on screen B to change the value or do something else on screen A.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search