value property
Getter - works everywhere (read access is always allowed)
Implementation
@override
T get value => super.value;
Setter that only works inside controller Throws error if called from outside the controller
Implementation
@override
set value(T newValue) {
final currentController = ControllerRegistry.current;
if (currentController != _controller) {
throw StateError(
'Cannot modify ControllerRx from outside its controller. '
'Use controller methods to update state.\n'
'Example: controller.increment() instead of controller.counter.value = 10'
);
}
super.value = newValue;
}