onWatchedValuableDispose method

  1. @override
void onWatchedValuableDispose(
  1. Valuable _
)
override

Allows inheriting classes to react when a watched Valuable is disposed.

Implementation

@override
void onWatchedValuableDispose(_) {
  // A watched Valuable was disposed, current value can't be computed anymore,
  // as one of its dependencies is now unreadable, so we need to dispose this Valuable as well
  // to prevent it to be read with an inconsistent state, and to clean all the links to the other Valuables that may cause memory leak
  dispose();
}