notifier property

JoltValueNotifier<T> get notifier

Converts this Jolt value to a Flutter ValueNotifier.

Returns a cached instance synchronized with this value. Multiple calls return the same instance. Supports bidirectional sync.

Example:

final counter = Signal(0);
final notifier = counter.notifier;

ValueListenableBuilder<int>(
  valueListenable: notifier,
  builder: (context, value, child) => Text('$value'),
)

Implementation

JoltValueNotifier<T> get notifier {
  var notifier = _notifiers[this] as JoltValueNotifier<T>?;

  if (notifier == null) {
    _notifiers[this] = notifier = JoltValueNotifier(this);
  }

  return notifier;
}