Getting Error When Adding: commandLineOptions: [–enable-experimental-mirrors]


I got a warning after adding http: to my pub spec.yaml. I did a search on it and this post said to add this to my pubspec:

- $dart2js:
commandLineOptions: [--enable-experimental-mirrors]

I did and got the error:

Error on line 12, column 3 of pubspec.yaml: A transformer map must have a   single key: the transformer identifier.
- $dart2js:

I didn’t have $dart2js in my working pubspec before this point. I had – dart_to_js_script_rewriter. The pubspec was initially created by the PHPStorm IDE. Has the method of correction changed? Here is my complete pubspec:

name: jazzcat
description: A catalog of jazz music
version: 0.0.1
  sdk: '>=1.13.0 <2.0.0'
  angular2: 2.0.0-beta.17
  browser: ^0.10.0
  dart_to_js_script_rewriter: ^1.0.1
- $dart2js:
  commandLineOptions: [--enable-experimental-mirrors]
- angular2:
    - 'package:angular2/common.dart#COMMON_DIRECTIVES'
    - 'package:angular2/common.dart#COMMON_PIPES'
    entry_points: web/main.dart
- dart_to_js_script_rewriter


Two possible issues:

The dart2js transformer has to be after the Angular transformer because the Angular transformer is working on the Dart files before they get compiled to JavaScript.

The second problem could be the indention level of the commandLineOptions key as it’s indention level is different from the other keys.

Answered By – Fox32

Answer Checked By – Candace Johnson (FlutterFixes Volunteer)

Leave a Reply

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