Skip to content

Unexpected Widget Rebuild with Hot Reload After Adding auto_route #1999

Answered by Milad-Akarie
Mir1001 asked this question in Q&A
Discussion options

You must be logged in to vote

@Mir1001 from the looks of it you need to use ref.listen instead of ref.watch.
as ref.listen is guaranteed to be trigger only when the state changes.

when you're not using revirpod, try to do your navigation inside initState method, which means using a Statefulwidget instead of a statelessWidget.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@Mir1001
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by Mir1001
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