2

Updated to Flutter 1.17.0 and a syntax I've been using for months now has an error:

For useless code example:

List<Widget> someList;
bool _isAdmin;

Column buildColumn() {
   return Column(
      children: <Widget>[
         someList[0],
         if (_isAdmin) someList[1],
      ]
   )
}

When I hover over the red underlined 'if' i see:
"This requires the 'control-flow-collections' experiment to be enabled. Try enabling this experiment by adding it to the command line when compiling and running.dart(experiment_not_enabled)"

There are obviously other ways of doing this task, but I've now got 13k lines of code that use this method and it would be easier to just get flutter to allow it. Or is there some reason I shouldn't??

Maksym Moros
  • 499
  • 7
  • 21
  • 1
    Does this answer your question? [flutter --flow-control-collections are needed, but are they?](https://stackoverflow.com/questions/59458433/flutter-flow-control-collections-are-needed-but-are-they) – jamesdlin May 21 '20 at 15:12
  • Yes. That was the solution I used. Oddly enough, the problem went away and the analysis_options.yaml file became redundant. – Maksym Moros May 21 '20 at 15:16

1 Answers1

1

Fixed:

I created an 'analysis_options.yaml' file at root and restarted VSCode:

analyzer:
  enable-experiment:
    - control-flow-collections
    - spread-collections
Maksym Moros
  • 499
  • 7
  • 21