必须向 Text 小部件提供非空字符串 [英] A non-null String must be provided to a Text widget
本文介绍了必须向 Text 小部件提供非空字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试添加要调整数量的选项,但我收到一条错误消息,提示必须向文本小部件提供非空字符串"我如何提供这个,这个代码?
I'm trying to add the option for the quantity to be adjusted but I get an error saying "A non-null String must be provided to a Text widget" How do I provide this, to this code?
trailing: Container(
height: 60,
width: 60,
padding: EdgeInsets.only(left: 10),
child: Column(
children: <Widget>[
new GestureDetector(child: Icon(Icons.arrow_drop_up), onTap: () {}),
new Text(cart_prod_qty),
new GestureDetector(child: Icon(Icons.arrow_drop_down), onTap: () {})
],
),
推荐答案
你应该检查 null 安全
You should check null safe
Text(cart_prod_qty??'default value'),
这篇关于必须向 Text 小部件提供非空字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文