Sdk: Editing assists add new/const even when run in dart 2 mode

Created on 15 Feb 2018  路  7Comments  路  Source: dart-lang/sdk

Repro steps:

  1. Enable dart 2 preview in the editor
  2. Use the editing assist to 'Center widget'

Expected result: assist adds Center(child: ...)
Actual result: assist adds new Center(child: ...)

analyzer-quick-fix area-analyzer preview-dart-2

All 7 comments

cc @scheglov

We should likely try and match the surrounding code style here, or key off a user preference or analysis options file setting?

I'd be much bolder and always omit these when using Dart 2 for Flutter. I see no reason why we could encourage manually adding new/const for Flutter code.

(We can always add a setting later if there is lots of demand for it)

From some discussion, a setting available in the analysis options file, and falling back to the --preview-dart-2 state, would likely hit satisfy most use cases.

We may delay implementing an analysis options setting until we know there's need for it.

Was this page helpful?
0 / 5 - 0 ratings