unlistenSignal<T> function

  1. @Deprecated('use SignalsMixin in StatefulWidget')
void unlistenSignal<T>(
  1. BuildContext context,
  2. ReadonlySignal<T> signal,
  3. void callback(), {
  4. String? debugLabel,
})

Remove all subscribers for a given signal for watchers

Implementation

@Deprecated('use SignalsMixin in StatefulWidget')
void unlistenSignal<T>(
  BuildContext context,
  ReadonlySignal<T> signal,
  void Function() callback, {
  String? debugLabel,
}) {
  final ctx = context;
  if (ctx is StatefulElement) {
    final state = ctx.state;
    if (state is SignalsMixin) {
      state.unlistenSignal(signal, callback);
      return;
    }
  }
  final key = ctx.hashCode;
  _elementRefs.remove(key)?.unlisten(signal, callback);
}