pauseNotifications<T> method
Pause notifications until after a synchronous handler has completed.
If notifyAfter
is true
, then listeners will automatically be notified
after the callback completes. Otherwise, you must notify the listeners;
Implementation
T pauseNotifications<T>(ChangeHandler<T> handler,
[bool notifyAfter = false]) {
final prevState = _paused;
_paused = true;
final result = handler();
_paused = prevState;
if (notifyAfter) {
notifyListeners();
}
return result;
}