notify<T> method

void notify<T>(
  1. void callback(
    1. T
    )?,
  2. T value
)

安全触发外部回调(仅在策略活跃时执行)

用于在 onStop 等生命周期方法中安全地触发外部通知, 框架保证策略停止后不会调用回调。

Safely invokes an external callback only when the strategy is active. Use this in onStop or other lifecycle methods to avoid notifying destroyed UI subscribers.

Implementation

void notify<T>(void Function(T)? callback, T value) {
  if (isActive) callback?.call(value);
}