Moataz Hamouda
Moataz Hamouda

Reputation: 1

upgrade Flutter SDK to the last version and get and Error with If

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

Upvotes: 0

Views: 838

Answers (3)

Moataz Hamouda
Moataz Hamouda

Reputation: 1

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

Upvotes: 0

timilehinjegede
timilehinjegede

Reputation: 14053

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.

Upvotes: 0

Rub&#233;n Cant&#243;n
Rub&#233;n Cant&#243;n

Reputation: 124

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?

Upvotes: 0

Related Questions