ViliX64 ViliX64 - 1 year ago 150
Dart Question

Dart2JS and Enumerators

I'm using enumerators (experimental) in my project. Pub Build (Generate JS) in my Dart Editor does not work due to the enums. In my console, this command:

dart2js file.dart --enable-enum

does work, but it is inconvinient to do it through the console. Is there any way to add arguments to the default command in Dart Editor (--enable-enums) so it'd allow it to compile into JS?

Running it by default in Dartium works and when copying and pasting the server url (
), the dart2js is triggered and it starts working (after average compilation time).

EDIT: Yes, I have enums enabled in my editor.

EDIT2: To enable enums in dart2js, I have this transformer in pubspec.yaml:

- $dart2js:
commandLineOptions: [--enable-enum]

However, I get this error in a file, which uses enums:

Directive not allowed here.
part of thing;
[Info from Dart2JS]:

It's weird that it works in the console with the same arguments and not in the editor.

I have filled a bug report here.

Answer Source

As of 2016, the enumerators are fully implemented.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download