ProviderSidecar<EX> class abstract

对ChangeNotifier进行包装 EX 抛出的异常类型, 便于UI代码展示错误信息

Inheritance

Constructors

ProviderSidecar({SidecarState state = SidecarState.uninitialized, String msg = 'Init with Constructor', EX onCatch(dynamic e, StackTrace s)?})

Properties

hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
msg String
getter/setter pair
onCatch → (EX Function(dynamic e, StackTrace s)?)
0.1 构造方法
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state SidecarState
0.2 配置核心状态变量get方法
getter/setter pair

Methods

actInitializing({String m = "初始化...", dynamic onInitializing()?}) Future<EX?>
0.4 配置 actXxx方法 act ---------------------------------------------------------------------- 状态设为 正在初始化 onInitializing 函数内应当执行耗时的初始化代码
actWrapper([Function? action]) Future<EX?>
统一处理异常
addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
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
Call all the registered listeners.
inherited
onInitializing() → dynamic
完成后需要手动调用 setInitialized
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
reqWrapper<T>(T? onAccess(), {List<SidecarState>? accContain, List<SidecarState>? rejContain, bool accCustom()?, T? onReject()?}) → T?
处理前置触发条件, 防抖节流等 可选条件参数最多使用1个, 如果使用多个,则只有首个非空参数逻辑生效 如果不适用任何参数,则默认通过
setInitialized<T>([String m = "初始化完成", T before()?]) → T?
setInitializing<T>([String m = "初始化...", T before()?]) → T?
setUninitialized<T>([String m = "未初始化", T before()?]) → T?
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

log → dynamic
no setter

Static Methods

setLogger(dynamic log(Object? message, [Object? error, StackTrace? stackTrace])) → dynamic