I'm wondering whether it is safe to place passwords directly in the Dart code like below. Does Flutter remove the code when compiling it for release? Of course I want to make sure that the code cannot be decompiled such that the username and password can be extracted.
bool get isInDebugMode {
bool inDebugMode = false;
assert(inDebugMode = true);
return inDebugMode;
}
if(inDebugMode){
emailController.text = '[email protected]';
passwordController.text = 'secret';
}
The code you provided won't be tree-shaked. As isInDebugMode
isn't a constant.
Instead you can use an assert
this way:
assert(() {
emailController.text = '[email protected]';
passwordController.text = 'secret';
return true;
}());
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