I've been struggling to understand when ChangeNotifier is preferred over Rxdart's Observable, or streams in general.
According to Flutter's docs:
A class that can be extended or mixed in that provides a change notification API using VoidCallback for notifications.
ChangeNotifier is optimized for small numbers (one or two) of listeners. It is O(N) for adding and removing listeners and O(N²) for dispatching notifications (where N is the number of listeners).
Still, I'm not sure what ChangeNotifier can offer that an Observable or Stream cannot.
Some updates since you asked this question
But I would focus less on performance and more on the use-case. ValueNotifier is a lighter-weight solution, but not as robust as Streams.
This Reddit thread does a great job describing the difference in use-case. As does this StackOverflow post.
But to summarize:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With