I found this about dart obfuscation in flutter, but it only says how to enable obfuscation. I tried looking up in what seems to be the snapshot generator arguments here, but the only arguments exposed regarding obfuscation are:
--obfuscate
--save-obfuscation-map=<map-filename>
I know this answer is super late, but for whoever that needs this now:
To prevent certain classes from getting obfuscated, add @pragma("vm:entry-point")
above the class definition.
Doing this will make the class name survive obfuscation.
e.g.:
@pragma("vm:entry-point")
class MyAwesomeClass {
const MyAwesomeClass(this.id, tnis.name);
int id;
String name;
}
Reference: https://github.com/dart-lang/sdk/blob/master/runtime/docs/compiler/aot/entry_point_pragma.md#classes
As far as I know, it's not possible to only obfuscate part of your application. I don't recall that ever being requested by a Google team using Flutter, so I would be extremely surprised if this was possible.
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