dart client side hide/obfuscate code

840 views Asked by At

Is it possible to hide/obfuscate the client side dart code (or js generated by dart)?

It looks like obfuscation is the route to when using javascript. Does dart come with an obfuscator?

thanks

1

There are 1 answers

0
Günter Zöchbauer On

When you run pub build from command line default is tree-shaking and minification. (When you run it from within DartEditor tree-shaking and minification is disabled.

I think minification and tree-shaking is pretty close to obfuscation but obfuscation wasn't the goal, just to reduce the file size the client needs to download. Tree-shaking removes code that isn't actually called anywhere and minification replaces the readable names by short random character combination.

Beside that I'm not aware of any obfuscation solution for Dart.

Dart2Dart will do the same for Dart code but it is only experimental currently.

Here is an example how to configure pub build to output Dart code (dart2dart) instead of JavaScript Run Dart WebApp on Apache Server