mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Be more explicit when ValueNotifier notifies (#30461)
This commit is contained in:
parent
952e307dcb
commit
3c8dabefe7
@ -248,14 +248,18 @@ class _MergingListenable extends Listenable {
|
||||
|
||||
/// A [ChangeNotifier] that holds a single value.
|
||||
///
|
||||
/// When [value] is replaced, this class notifies its listeners.
|
||||
/// When [value] is replaced with something that is not equal to the old
|
||||
/// value as evaluated by the equality operator ==, this class notifies its
|
||||
/// listeners.
|
||||
class ValueNotifier<T> extends ChangeNotifier implements ValueListenable<T> {
|
||||
/// Creates a [ChangeNotifier] that wraps this value.
|
||||
ValueNotifier(this._value);
|
||||
|
||||
/// The current value stored in this notifier.
|
||||
///
|
||||
/// When the value is replaced, this class notifies its listeners.
|
||||
/// When the value is replaced with something that is not equal to the old
|
||||
/// value as evaluated by the equality operator ==, this class notifies its
|
||||
/// listeners.
|
||||
@override
|
||||
T get value => _value;
|
||||
T _value;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user