putWithLogging method

  1. @visibleForTesting
  2. @protected
T putWithLogging(
  1. T value, {
  2. OnLogging<T>? logging,
})

Implementation

@visibleForTesting
@protected
T putWithLogging(T value, {OnLogging<T>? logging}) {
  final prv = this.value;
  if (isClosed) {
    throw StateError('Cannot emit new states after calling close');
  }
  if (prv != value) {
    // ignore: invalid_use_of_visible_for_testing_member
    emit(value);
  }
  logger(
    '${logging?.call(prv, value) ?? value}',
    level: logging != null ? Level.INFO.value : Level.FINE.value,
    logExtra: logExtra,
  );
  return value;
}