I have installed a release build apk in the android device but if I connect that device to Android studio then I am able to see all Logs/debugPrint statements.
Is there any way to disable the all the logs ?
I combined the accepted answer with the idea from here and used it main.dart to silence all debugPrint everywhere.
const bool isProduction = bool.fromEnvironment('dart.vm.product');
void main() {
if (isProduction) {
// analyser does not like empty function body
// debugPrint = (String message, {int wrapWidth}) {};
// so i changed it to this:
debugPrint = (String? message, {int? wrapWidth}) => null;
}
runApp(
MyApp()
);
}
You can assign a dummy function to the global debugPrint
variable:
import 'package:flutter/material.dart';
main() {
debugPrint = (String message, {int wrapWidth}) {};
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With