notify abstract method
Triggers a change notification without modifying the value.
Notifies all subscribers that they should re-evaluate. The behavior
depends on the force parameter and the specific implementation:
- When
forceistrue(force update), subscribers are notified regardless of whether the value changed. - When
forceisfalse(soft update), subscribers are only notified if the value actually changed during recomputation.
This is useful for scenarios like in-place mutations where the value reference doesn't change but the content does.
Parameters:
force: Iftrue, forces notification even if the value hasn't changed. The default value depends on the implementation (e.g.,falsefor Computed,truefor Signal).
Example:
final list = ListSignal([1, 2, 3]);
list.value.add(4); // Mutation doesn't auto-notify
list.notify(); // Force subscribers to update
final computed = Computed(() => expensiveCalculation());
computed.notify(); // Soft update: only notifies if value changed
computed.notify(true); // Force update: always notifies subscribers
Implementation
void notify([bool force]);