postModel.loading
? Center(child: CircularProgressIndicator(),)
:
...renderVideoCards()
This code is part of the column the part that was generating error is ( ...renderVideoCards() ). So let me know where i am going wrong and what should i do to reslove this error
CodePudding user response:
You are trying to assign List type to Widget. You need to change it to a single widget to assign in Widget.
CodePudding user response:
I believe the spread operator ...
doesn't work well together with the ternary expression. I believe writing it like this would solve it for you:
if (postModel.loading) Center(child: CircularProgressIndicator())
else ...renderVideoCards(),
or alternatively write it like this:
...postModel.loading
? [Center(child: CircularProgressIndicator())]
: renderVideoCards()
CodePudding user response:
I'm guessing that your renderVideoCards()
function returns a List<Widget>
.
So you are trying to assign a List somewhere where you should assing a single Widget.
You can fix this problem by using a Column
or a Row
: that is a single Widget with multiple children.
postModel.loading
? Center(child: CircularProgressIndicator(),)
:
...Column(children: renderVideoCards())