-1

i run flutter upgrade it works correctly but then i got errors with if used with widget

error: This requires the 'control-flow-collections' experiment to be enabled

this is my flutter version after update i run flutter --version and this was the result

Flutter 1.17.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f7a6a7906b (9 days ago) • 2020-05-12 18:39:00 -0700
Engine • revision 6bc433c6b6
Tools • Dart 2.8.2

i need some help thank you

  • 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

1 Answers1

0
  1. update your pubspec.yaml

    sdk: ">=2.7.0 <3.0.0"

2.Create a file at your project root named analysis_options.yaml

3.Paste this into the newly created file

analyzer:
  enable-experiment:
    - spread-collections

4.Just save all and restart your editor then open terminal at your project directory and type 'flutter pub get`

Constantin N.
  • 2,739
  • 2
  • 16
  • 27
  • i don't understand where to paste this kines – Mohamed Borhene Dhahri May 21 '20 at 13:43
  • The first one into pubspec.yaml(already existn, just update it) and second one into analysis_options.yaml – Constantin N. May 21 '20 at 13:49
  • the first one i know thank you for you help but i'm new with flutter try to explain simply the file analysis_options.yaml it exists or should i create it if i should create it i past the code or what i shouls do try to explain and thank you – Mohamed Borhene Dhahri May 21 '20 at 14:02
  • Please read section 2. of my answer i've already told you how to do it there. You should CREATE a new file named `analysis_options.yaml` then paste these 3 line into the newly created file – Constantin N. May 21 '20 at 14:05
  • thank you very much i took a lot of your time but the error still with the new file should i run some command or what because i run package get in pubsec..yam and nothing happens – Mohamed Borhene Dhahri May 21 '20 at 14:10
  • Just save it. Restart your editor then open terminal at your project directory and type '`flutter pub get` – Constantin N. May 21 '20 at 14:13
  • You're wellcome. Please don't forget to upvote my answer too – Constantin N. May 21 '20 at 14:24
  • This doesn't really make any sense since spread-collections has been a non-experimental language feature since Dart 2.3. As long as the `sdk` requirement is `>= 2.3 < 3.0.0` (or higher), explicitly running `pub upgrade`/`flutter pub upgrade` should fix the problem. – jamesdlin May 21 '20 at 15:08