observe abstract method

void observe({
  1. required Model? modelPrevious,
  2. required Model? modelCurrent,
  3. bool? isDistinct,
  4. StoreConnectorInterface? storeConnector,
  5. int? reduceCount,
  6. int? dispatchCount,
})

The ModelObserver can be used to observe and troubleshoot the model changes.

The storeConnector works by rebuilding the widget when the model changes. It needs to compare the modelPrevious with the modelCurrent to decide if the widget should rebuild:

  • isDistinct is true means the widget rebuilt because the model changed.
  • isDistinct is false means the widget didn't rebuilt because the model hasn't changed.
  • isDistinct is null means the widget rebuilds everytime (because of the StoreConnector.distinct parameter), and the model is not relevant.

Implementation

void observe({
  required Model? modelPrevious,
  required Model? modelCurrent,
  bool? isDistinct,
  StoreConnectorInterface? storeConnector,
  int? reduceCount,
  int? dispatchCount,
});