-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Description
Steps to reproduce
In the docs for ValueNotifier, we see:
/// Because this class only notifies listeners when the [value]'s identity
/// changes, listeners will not be notified when mutable state within the
/// value itself changes.
But in fact, if you check the code, it calls ==, not identical() so it will in fact notify if an overridden equality reports false.
The docs go on to blur this by using List, which does an identity check for equality, and is thus a common but bad example.
The docs could be updated to show that == is being used, and will properly use a deeper equality test if the object class provides it.
Expected results
Reader is informed, and can properly infer the behavior looking only at the documentation.
Actual results
Reader is confused, and must dig into the source code to explain a bug.