UpdatableMx<T> mixin

Superclass constraints
Mixin applications

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stream Stream<T>
get value's stream
no setterinherited
value → T
get current value
no setterinherited

Methods

debounce<R>(Object tag, Duration duration, FutureOr<R> action(), {Duration? maxDuration}) FutureOr<R?>
debounce 防抖: 停止操作后等待 duration 执行最后一次。 maxDuration: 可选,解决“无限重置”问题。如果持续触发超过此时间,强制执行一次。
inherited
dispose() → void
inherited
isDebounceLocked(Object tag) bool
检查是否正在防抖等待中
inherited
isMutexLocked(Object tag) bool
检查是否正在执行 mutex 任务
inherited
isThrottleLocked(Object tag) bool
检查是否处于节流冷却期
inherited
mutex<R>(Object tag, FutureOr<R> action()) FutureOr<R?>
mutex 互斥锁 (Exhaust): 立即执行,执行期间的触发直接丢弃。
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
put(T value) → T
put new value
inherited
putError(Object error, [StackTrace? stackTrace]) → void
put new error
inherited
runCatching<R>(FutureOr<R?> block(), {FutureOr<R?> onSuccess(R data)?, FutureOr<R?> onFailure(Object e, StackTrace s)?, bool ignoreSkipError = true, int slowlyMs = 0, Object? debounceTag, Object? throttleTag, Object? mutexTag}) FutureOr<R?>
ignoreSkipError same as update((o)=>null) true: SkipError will not trigger onFailure when true ref skpIf/skpNull slowlyMs if set <=0 value, will ignore debounce/throttleTag debounceTag enable debounce throttleTag enable throttle mutexTag enable concurrency lock (Exhaustive behavior)
inherited
skpIf(bool condition, String reason) → void
if you want interrupt the normal flow, but not trigger runCatching.onFailure
inherited
skpIfNull(Object? obj, String reason) → void
if obj ==null, throw SkipError ref skpIf
inherited
skpNull<T>(T? obj, String reason) → T
if obj == null: throw SkipError else: return obj!
inherited
throttle<R>(Object tag, Duration duration, FutureOr<R> action(), {bool ensureLast = false}) FutureOr<R?>
throttle 节流: 固定频率执行。 配合 mutex 解决异步任务重叠问题:如果周期到了但上次任务还没跑完,直接跳过。 ensureLast: 如果为 true,则在节流期间的最后一次触发将被防抖补发。
inherited
toString() String
A string representation of this object.
inherited
update(FutureOr<T> updater(T old), {dynamic onError(Object e, StackTrace s)?, int slowlyMs = 100, Object? debounceTag, Object? throttleTag, Object? mutexTag, dynamic ignoreSkipError = true}) FutureOr<T?>
updater if return value, will call put if return null, will not call put/putError onError if set null,will call putError if set function value, will not call putError, you can invoke putError manually slowlyMs if set <=0 value, will ignore debounce/throttleTag debounceTag enable debounce, require unique within the VM scope throttleTag enable throttle, require unique within the VM scope mutexTag enable concurrency lock (Exhaustive behavior), if the previous update with the same mutexTag is still running, the current update will be ignored. ignoreSkipError ref runCatching.ignoreSkipError
updateRaw(FutureOr<T> up(T old), {dynamic onError(Object e, StackTrace s)?, int slowlyMs = 100, Object? debounceTag, Object? throttleTag, dynamic ignoreSkipError = true}) FutureOr<T?>
Deprecated use 'update'

Operators

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