ReadObservableField<T> class

订阅字段 在 ValueNotifier 的基础上加上了可传空 @author sunlunchang

泛型类 ReadObservableField,继承自 ChangeNotifier 并实现 Listenable 接口 用于创建可观察的字段,支持泛型类型 T

Inheritance
Implemented types
Implementers

Constructors

ReadObservableField({bool single = false})
构造函数,初始化 ReadObservableField 实例 single 表示是否只允许单个监听器,默认为 false

Properties

hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
single bool
final
value → T?
获取字段的值
no setter

Methods

addListener(VoidCallback listener) → void
重写 addListener 方法,用于添加监听器 如果已经有监听器且 single 为 true,则不添加新的监听器
override
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
重写 notifyListeners 方法,用于通知所有监听器
override
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited