Closed NamanShergill closed 9 months ago
I have been trying to debug the cause of this for the last few hours, but I am lost. Any ideas?
I have learned a very valuable lesson in the difference between GlobalKey
and ValueKey
today. I was supposed to use the former to preserve the widget state on being moved in the tree. Can't believe the fix was so simple.
Can be seen by modifying the example to move the counter into a stateful widget. Changing the theme calls the initState on the widget again, and the counter is also back to 0. Specifying a ValueKey doesn't prevent the rebuild either.