Can a ChangeNotifierProvider
's ChangeNotifier
get recreated?
My impression from reading this is that when a ChangeNotifierProvider
does create: (context) => SomeChangeNotifier()
, SomeChangeNotifier
is guaranteed to never be recreated:
This is done one time when the widget is first built, and not on subsequent rebuilds.
This is what I would hope and expect. However, according to the Flutter documentation:
ChangeNotifierProvider is smart enough not to rebuild [its ChangeNotifier] unless absolutely necessary.
Note the "unless absolutely necessary" part, which suggests that the ChangeNotifier
can be recreated.