[英]Flutter: show another value when value is null
將此檢查也添加到您的||
produtosList1[index].qtd == "null"
。
您的應用顯示null
而不是空字符串""
因為qtd
中的值很可能是String "null"
。
如果你有一個可以是null
的變量,你可以這樣做來顯示其他東西而不是它: produtosList1[index].qtd?? 'Instead of null'
produtosList1[index].qtd?? 'Instead of null'
。
??
返回其左側的表達式,除非該表達式的值為 null,在這種情況下,它計算並返回其右側的表達式。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.