CancellableValueNotifier<T> class
Cancellable 取消后 set value 不在发出通知
- Inheritance
-
- Object
- ChangeNotifier
- ValueNotifier<
T> - CancellableValueNotifier
- Available extensions
Constructors
- CancellableValueNotifier(T _value, Cancellable _cancellable, [bool notifyWhenEquals = false])
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- notifyWhenEquals → bool
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value ↔ T
-
The current value stored in this notifier.
getter/setter pairoverride
Methods
-
addCListener(
Cancellable cancellable, VoidCallback listener) → void -
Available on Listenable, provided by the ListenableCancellable extension
添加listener, 并且当cancellable执行cancel时自动移除listener -
addCSingleListener(
Cancellable cancellable, VoidCallback listener) → void -
Available on Listenable, provided by the ListenableCancellable extension
添加 一个唯一性的listener, 并且当cancellable执行cancel时自动移除listener, 多次添加也只会执行一次listener, 默认的 addCListener 如果添加多次,会多次调用listener -
addCSingleVListener(
Cancellable cancellable, void listener(T value)) → void -
Available on ValueNotifier<
添加一个 唯一性的 含当前值T> , provided by the ValueNotifierCancellable extensionlistener, 当cancellable执行cancel时自动移除listener, 多次添加也只会执行一次listener, -
addCVListener(
Cancellable cancellable, void listener(T value)) → void -
Available on ValueNotifier<
添加一个 含当前值T> , provided by the ValueNotifierCancellable extensionlistener, 当cancellable执行cancel时自动移除listener, -
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
override
-
asStream(
) → Stream< T> -
Available on ValueNotifier<
将ValueNotifier转换为一个Stream, listen时会立即发送当前的值T> , provided by the ValueNotifierCancellable extension -
bindCancellable(
Cancellable cancellable) → T -
Available on T, provided by the ChangeNotifierCancellableV2 extension
与Cancellable关联 当Cancellable cancel时调用dispose -
bindLifecycle(
ILifecycle lifecycle) → T -
Available on T, provided by the ChangeNotifierCancellableV2 extension
与lifecycle关联 当lifecycle destroy时调用dispose -
Builder(
{required Widget builder(BuildContext context, T value, Widget child), Widget child = const SizedBox.shrink(), Key? key}) → Widget -
Available on ValueListenable<
快速构建一个ValueListenableBuilder ignore: non_constant_identifier_namesT> , provided by the ValueNotifierBuilderExt extension -
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).
override
-
disposeByCancellable(
Cancellable cancellable) → void -
Available on ChangeNotifier, provided by the ChangeNotifierCancellable extension
-
firstValue(
bool test(T value), {Cancellable? cancellable}) → Future< T> -
Available on ValueNotifier<
T> , provided by the ValueNotifierCancellable extension -
firstWhereValue(
bool test(T value), {Cancellable? cancellable}) → Future< T> -
Available on ValueNotifier<
当value首次满足条件时触发, cancellable 取消时取消监听T> , provided by the ValueNotifierCancellable extension -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
override
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
whenValue(
bool test(T value), {Cancellable? cancellable}) → Future< T> -
Available on ValueNotifier<
T> , provided by the ValueNotifierCancellable extension
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited