In release mode of flutter app, are console logs printed out with log
method from dart:developer
are visible? From docs of release mode we can read that
Debugging information is stripped out. Debugging is disabled.
and I assume it strip out everything printed with debugPrint
method, but I couldn't found anything about log
method.
Same goes for output with print
method? Are those prints will be visible for user who will be reading device log output or not? Dart linter only says that print should be avoided in production code, I assume because of print output visibility.
Chapter in flutter docs about logging says how to use them but not really answer questions above.
No, developer.log
does not display information on the terminal when in release mode.
But print()
will surely print all in any mode.
You can check that on android devices connected in USB, using adb logcat
or adb logcat | grep flutter
Just be careful not to print large amounts of information with developers.log
, as it won't truncate the string, as print actually does.
package: https://pub.dev/packages/dart_log
I actually created a package to handle logs(mentioned above), which allows you to define whether or not to print logs in release mode, and define the amount of characters that can be printed. all logs are linked to the file in exact line that logger was called, so you can click on it, and easily open the file that dispatched the log :)