onLevelChanged property

Stream<Level?> get onLevelChanged

Returns a stream of level values set to this Logger.

You can listen for set levels using the standard stream APIs, for instance:

logger.onLevelChanged.listen((level) { ... });

A state error will be thrown if the level is changed inside the callback.

Implementation

Stream<Level?> get onLevelChanged {
  _levelChangedController ??= StreamController<Level?>.broadcast(sync: true);
  return _levelChangedController!.stream;
}