DKStateEventHelper class

DKStateEvent 工具类 - 提供通用的状态管理逻辑

这个类包含可复用的状态管理方法,可以被不同的状态管理方式使用:

  • StreamController 扩展
  • ValueNotifier 扩展
  • 其他自定义状态管理

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

handleState<T>(DKStateEvent<T> state, {void onLoading()?, void onSuccess(T data)?, void onError(String message, Object? error, StackTrace? stackTrace)?, void onIdle()?, void onComplete()?}) Future<void>
处理单个状态事件并执行对应回调
triggerEvent<T>({required void onStateChange(DKStateEvent<T> state), required Future<T> event(), String? tag}) Future<void>
触发事件并自动管理状态变化