Add documentation which explains that debugPrint also logs in release mode (#141595)
It's confusing that `debugPrint` also prints in release mode, given that a lot (most?) other things prefixed with `debug` don't do anything in release mode. Therefore, this adds some documentation that this is indeed logging in release mode and adds an example how to disable this. *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
This commit is contained in:
@@ -31,6 +31,14 @@ typedef DebugPrintCallback = void Function(String? message, { int? wrapWidth });
|
||||
/// Prints a message to the console, which you can access using the "flutter"
|
||||
/// tool's "logs" command ("flutter logs").
|
||||
///
|
||||
/// The [debugPrint] function logs to console even in [release mode](https://docs.flutter.dev/testing/build-modes#release).
|
||||
/// As per convention, calls to [debugPrint] should be within a debug mode check or an assert:
|
||||
/// ```dart
|
||||
/// if (kDebugMode) {
|
||||
/// debugPrint('A useful message');
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [DebugPrintCallback], for function parameters and usage details.
|
||||
|
||||
Reference in New Issue
Block a user