OnWillChangeCallback<Model> typedef Null safety

void OnWillChangeCallback<Model>(
  1. Model previousViewModel,
  2. Model newViewModel

A function that will be run on state change, before the build method. This function is passed the Model, and if distinct is true, it will only be called if the Model changes. This is useful for making calls to other classes, such as a Navigator or TabController, in response to state changes. It can also be used to trigger an action based on the previous state.


typedef OnWillChangeCallback<Model> = void Function(
  Model previousViewModel,
  Model newViewModel,