rrousselGit / state_notifier

ValueNotifier, but outside Flutter and with some extra perks
MIT License
311 stars 28 forks source link

Request updateShouldNotify #54

Closed nogaten closed 2 years ago

nogaten commented 2 years ago

Is your feature request related to a problem? Please describe. In the new version of StateNotifier, there is a fix that does not notify listeners if it is identical when updating state. Sometimes I want to notify listeners even if the objects is identical. I want you to be able to choose whether to notify listeners.

Describe the solution you'd like I would like a method like the one below and I want it to be able to be overridden.

bool updateShouldNotify(T previous, T current) {
  return !identical(previous, current);
}
ebelevics commented 2 years ago

It seems I'm not the only one facing this issue. I have provided suggestion to overcome this issue in pull request https://github.com/rrousselGit/state_notifier/pull/57.