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

前端 未结 3 1439
没有蜡笔的小新
没有蜡笔的小新 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:23

    Even after changing the dart version didn't work, then just restart your VS Code or whatever editor you're using. Then check if the error is there. If so, then run flutter clean.

    0 讨论(0)
  • 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:

    <Widget>[
      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"
    
    0 讨论(0)
  • 2020-12-03 05:35

    Change dart version in pubspec.yml

    environment:
      sdk: ">=2.6.0 <3.0.0"
    

    then

     flutter pub get
     flutter clean
    

    And restart Android Studio

    0 讨论(0)
提交回复
热议问题