Skip to content

Custom FlutterHooks Not Disposed or Duplicated with GoRouter and AdaptiveScaffold #351

Discussion options

You must be logged in to vote

This issue might be caused by GoRouter always creating a new Page without deleting the previous one. Is there a way to handle this situation?

Pop those pages.
This is unrelated to hooks :)

My goal being that the hooks "init/dispose" when opening and closing pages without duplicating.

If you're expecting state to be shared between routes, that's not hooks you're looking for, but something like Riverpod.

Hooks are nothing but a different way of writing StatefulWidgets. You would have the exact same issues with StatefulWidgets.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@vincent-herlemont
Comment options

Answer selected by vincent-herlemont
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants