flutter --flow-control-collections are needed, but are they?

前端 未结 3 1445
没有蜡笔的小新
没有蜡笔的小新 2020-12-03 04:55

After upgrading flutter (both master and stable versions) and dart, I get an error about the experiment --flow-control-collections not being enabled for various for-loops th

3条回答
  •  隐瞒了意图╮
    2020-12-03 05:33

    Hey, I had the same issue this morning but found a fix.

    1) Keep the analysis_options.yaml in your root folder with this code:

    analyzer:
      enable-experiment:
        - control-flow-collections
    

    2) Don't use brackets {} in between your for loops Ex:

    [
      for (final category in categories) 
        CategoryWidget(category: category)
    ],
    

    3) Important step which is probably why it's not working for you: Change your Dart version constraint in the pubspec.yml file in your root folder to 2.5.2

    environment:
      sdk: ">=2.5.2 <3.0.0"
    

提交回复
热议问题