DebugPrintCallback typedef

DebugPrintCallback = void Function(String? message, {int? wrapWidth})

Signature for debugPrint implementations.

If a wrapWidth is provided, each line of the message is word-wrapped to that width. (Lines may be separated by newline characters, as in '\n'.)

By default, this function very crudely attempts to throttle the rate at which messages are sent to avoid data loss on Android. This means that interleaving calls to this function (directly or indirectly via, e.g., debugDumpRenderTree or debugDumpApp) and to the Dart print method can result in out-of-order messages in the logs.

The implementation of this function can be replaced by setting the debugPrint variable to a new implementation that matches the DebugPrintCallback signature. For example, flutter_test does this.

The default value is debugPrintThrottled. For a version that acts identically but does not throttle, use debugPrintSynchronously.

Implementation

typedef DebugPrintCallback = void Function(String? message, { int? wrapWidth });