withSilencedUpdate method

  1. @protected
  2. @visibleForTesting
Future<void> withSilencedUpdate(
  1. FutureOr<void> updater()
)
inherited

The entity updates within the updater will not be notified to the UseCase listeners, but will silently update it.

Implementation

@protected
@visibleForTesting

/// The [entity] updates within the [updater] will not be notified to the
/// [UseCase] listeners, but will silently update it.
Future<void> withSilencedUpdate(FutureOr<void> Function() updater) async {
  assert(
    !_isSilentUpdate,
    '\n\nConcurrently running with more than one "withSilencedUpdate" '
    'modifier is not supported.\n',
  );

  _isSilentUpdate = true;
  await updater();
  _isSilentUpdate = false;
}