value property
The current value stored in this notifier.
When the value is replaced with something that is not equal to the old value as evaluated by the equality operator ==, this class notifies its listeners.
Implementation
@override
T get value => _value;
Not supported — this notifier is read-only by contract.
Writing through CellNotifier would create a second source of truth that diverges from the cell: the cell's integrity gates would be bypassed, and observers of the cell would not see the change. Mutate the cell instead:
notifier.value = 42; // throws UnsupportedError
notifier.cell.value = 42; // correct: routes through the cell
Throws:
Always throws UnsupportedError. The setter exists only to close the
ValueNotifier.value contract inherited from the superclass.
See Also:
- cell — the correct mutation target.
- CellNotifier class docs, Design Note:
CellNotifieris read-only by contract, for the rationale.
Implementation
@override
set value(V? _) {
throw UnsupportedError(
'CellNotifier: cannot assign value directly. '
'Mutate the cell: `cell.value = ...`.',
);
}