0

upgrade Flutter SDK to the last version and get and Error with If in the column of widget while using if to show one of widget after setstate and variable be true as shown in the image enter image description here

  • What is the Dart SDK constraint in your `pubspec.yaml` file? – jamesdlin May 08 '20 at 05:04
  • 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:11

3 Answers3

0

Here they talk about other flutter update. They said you should upgrade your min Dart version at pubspec.yaml Not sure if it will work but it's a similar issue than yours.

Maybe as a temp fix you could try the sintax: Condition ? True : False

Ups, I forgot the link :) flutter --flow-control-collections are needed, but are they?

0

You can fix this by replacing the if else statement with Ternary operators.

Ternary Operators are shorter ways of if-else statement. Syntax is :

testCondition ? trueValue : falseValue

Check the code below: it works fine.

 _isLoading
          ? CircularProgressIndicator()
          : RaisedButton(
              onPressed: () {},
              child: Text('Sign up'),
            ),

I hope this helps.

void
  • 12,787
  • 3
  • 28
  • 42
0

i change the SDK environment to sdk: '>=2.8.0 <3.0.0' and then flutter clean