How do i keep dart names (variables, constants, objects ) using dart2js commands?


I’m trying to compile a dart project by using the command

pub build

However, this will generate random identifiers for all objects, which will ruin all logging information when it prints the object name.

For example, “Object = K1” is printed instead of “Object = Mirror”.

Is there a way to keep all dart names, while compiling to .js?

I also tried:

pub build --mode=debug

…but the downside is that for production builds, debug mode is now allowed.

Is there any production build approach for this issue?


You can disable minification in pubspec.yaml:

- $dart2js:
  minify: false

See here for more details about the pub transformer.

Answered By – Danny Tuppeny

Answer Checked By – Mary Flores (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *