in flutter when I run the app in release mode the debugPrint statements print data which I don’t want to appear any ideas why this is happening ?
in flutter when I run the app in release mode the debugPrint statements print data which I don’t want to appear any ideas why this is happening ?
2
Answers
That’s how it is supposed to work. Maybe the name got you confused, but the docs are pretty clear:
debugPrint will print values in release mode. Its purpose is not to avoid print commands in release mode.
DebugPrint aims to avoid dropping messages on platforms that rate-limit their logging (for example, Android).
for example, you are trying to print a huge API response but it will not print full values because there is a set limit of statement length in a simple print command. Now, using debugPrint, you can print the whole response without limit.
Example
print("THIS IS A VERY BIG RESPONSE…") – Output THIS IS A VE….
debugPrint("THIS IS A VERY BIG RESPONSE…") – Output THIS IS A VERY BIG RESPONSE…
Note: In above example instead of "THIS IS A VERY BIG RESPONSE…" assume a very big value.
for more infor please reffer to docs.
If you want to avoide print values in production. Create a method and use it.