toSignal method

SignalValueListenable<T, ValueListenable<T>, ReadonlySignal<T>> toSignal({
  1. String? debugLabel,
})

SignalValueNotifier

To create a ValueNotifier that is also a Signal:

final signal = SignalValueNotifier<int>(10);
// or
final signal = signalValueNotifier<int>(10);

expect(signal.value, 10);
expect(signal is Signal<int>, true);
expect(signal is ValueNotifier<int>, true);

Setting the value on the signal will update the notifier and vice versa.

Signal from ValueNotifier

To create a mutable signal from a ValueNotifier, use the toSignal extension:

final notifier = ValueNotifier(10);
final signal = notifier.toSignal();

Setting the value on the signal or notifier will update the other.

ValueNotifier from Signal

To create a ValueNotifier from a mutable signal, use the toValueNotifier extension:

final signal = Signal(10);
final notifier = signal.toValueNotifier();

Setting the value on the signal or notifier will update the other. @link https://dartsignals.dev/flutter/value-notifier

Implementation

SignalValueListenable<T, ValueListenable<T>, ReadonlySignal<T>> toSignal(
    {String? debugLabel}) {
  return SignalValueListenable<T, ValueListenable<T>,
      ReadonlySignal<T>>.fromValueListenable(this);
}