putWithLogging method
S
putWithLogging(
- S value, {
- OnLogging<S>? logging,
})
Implementation
@visibleForTesting
@protected
S putWithLogging(S value, {OnLogging<S>? 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;
}