NeuronControllerSignals extension
============================================================================ 3b. CONTROLLER SIGNAL FACTORY EXTENSIONS
Extension providing convenient signal factory methods on NeuronController.
This extension allows creating signals with automatic binding in a single call,
reducing boilerplate from Signal<T>(value).bind(this) to signal(value).
Usage
class CounterController extends NeuronController {
// Before: verbose syntax
late final count = Signal<int>(0).bind(this);
// After: clean factory syntax
late final count = signal(0);
late final name = signal('');
late final isActive = signal(false);
// Async signals
late final user = asyncSignal<User>();
// Computed values
late final doubled = computed(() => count.val * 2);
}
Methods
-
asyncSignal<
T> ({T? initial, String? debugLabel}) → AsyncSignal< T> -
Available on NeuronController, provided by the NeuronControllerSignals extension
Creates an AsyncSignal and automatically binds it to this controller. -
computed<
T> (T computation(), {String? debugLabel}) → Computed< T> -
Available on NeuronController, provided by the NeuronControllerSignals extension
Creates a Computed signal and automatically binds it to this controller. -
signal<
T> (T initial, {String? debugLabel, bool equals(T prev, T next)?, T guard(T current, T next)?, VoidCallback? onListen, VoidCallback? onCancel}) → Signal< T> -
Available on NeuronController, provided by the NeuronControllerSignals extension
Creates a Signal and automatically binds it to this controller.