debugPrintThrottled function
Implementation of debugPrint that throttles messages. This avoids dropping messages on platforms that rate-limit their logging (for example, Android).
If wrapWidth
is not null, the message is wrapped using debugWordWrap.
Implementation
void debugPrintThrottled(String? message, { int? wrapWidth }) {
final List<String> messageLines = message?.split('\n') ?? <String>['null'];
if (wrapWidth != null) {
_debugPrintBuffer.addAll(messageLines.expand<String>((String line) => debugWordWrap(line, wrapWidth)));
} else {
_debugPrintBuffer.addAll(messageLines);
}
if (!_debugPrintScheduled) {
_debugPrintTask();
}
}