我有一个应用程序,它有一个列表,当它为空时,它显示“空”,但我想显示任何东西,而不是它,但我不能。我试着做了一个验证,但由于某种原因它仍然显示为null。
代码如下:
child: Text(
produtosList1.isEmpty ||
produtosList1[index].qtd == "" ||
produtosList1[index].qtd == null
? " "
: produtosList1[index].qtd,
style: TextStyle(fontWeight: FontWeight.bold),
),
但以下是它的表现:
我做错了什么?
还将此检查添加到produtoslist1[index].qtd==“null”
。
您的应用程序显示的是null
而不是空字符串“”
,因为QTD
中的值很可能是字符串“null”
。