Let’s say I have a text and button in main screen(class) and showModalBottomSheet in different class, when main screen button pressed, it will trigger showModalBottomSheet that contain a button, that button will dismissed the modal bottom sheet and change(updateUI) text in main screen.
Can you give example how I can achieve this? or showModalBottomSheet cannot use in different class when I want to update the UI?
2
Answers
You can try this code i hope this is a use-full
You can pass anything back to the main screen by using this.
In your case we are passing String
Close the BottomSheet like this.
In the main screen you can fetch the value like this.