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