I have a flutter app that checks a list, and depending on what the if else
does, something pops up on the screen. I have an if
that checks if the list is empty or its length
equal to 0, an else
that if the list has content, it shows on the screen. But in case the list has size, but its contents are null, and so nothing is built on the screen, what I want to do is return a Text()
widget for example, which says 'nothing was found'. How can I treat this problem?
if (colors == null || colors.length == 0)
Center(
child: Padding(
padding: EdgeInsets.fromLTRB(40, 40, 40, 0),
child: CircularProgressIndicator(),
),
)
else if() //What should I do here?
//emptyState
else ...colorsList()