of<T extends FlutterReadonlySignal> static method

T? of<T extends FlutterReadonlySignal>(
  1. BuildContext context, {
  2. bool listen = true,
})

Retrieves the reactive signal instance of type T directly from the nearest SignalProvider.

  • If listen is true (default), the calling widget will automatically subscribe to the signal and rebuild whenever the signal's value changes.
  • If listen is false, the signal is returned without establishing a subscription. Use listen: false when mutating the signal inside action callbacks.

Implementation

static T? of<T extends FlutterReadonlySignal>(
  BuildContext context, {
  bool listen = true,
}) {
  final provider = _inheritedProviderOf<T>(context, listen: listen);
  return provider?.notifier;
}