How to resovle expected identifier and ':' expected error in flutter?

Viewed 10840

I have a surprising error from nowhere and I don't know how to solve it.It needs an identifier and ':'. How can I solve it?

Container(
              padding: EdgeInsets.only(top: 35.0, left: 20.0, right: 20.0),
              child:( _futureUser == null)
            ? Column(
                children: <Widget>[...]
)//column
)//Here I have an error //Container

enter image description here

2 Answers

You have to specify the else expression by adding the :
Try this :

Container(
   padding: EdgeInsets.only(top: 35.0, left: 20.0, right: 20.0),
   child:( _futureUser == null)? Column(children: <Widget>[...]):Container()
), 

You seem to have accidently added a conditional expression when you have a ? in front of your Column. If you want to show the Column regardless of whether _futureUser is null remove the ( _futureUser == null) ?, but if you want to show a different widget if that statement is false than add a : after the Column and declare you other widget. You may want to display nothing if _futureUser==null, in which case add a : Container() after the Column.

Related