string - A non-null String must be provided to a Text widget
问题描述
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 安全
Text(cart_prod_qty??'default value'),
推荐阅读
- javascript - 用于更改谷歌图表上显示 x 轴范围的按钮
- c# - 检查数据库中的重复值
- .net - 命名空间 System.Security 中不存在类型或命名空间名称 SecurityRulesAttribute
- c# - AspNetCore 无法解析服务
- mysql - 计算跨多列 sql 的字符串出现次数
- android - 在没有sqlite的情况下登录android
- methods - 使用在 Stream 中返回 Int 的方法
- javascript - HTML5, JS: 用 cam 拍照并保存
- kubernetes - 具有两个副本的 Kubernetes 部署:一个 pod 正在运行,另一个失败
- r - 如何在 R 中创建两个高度不等(不同的最大值)但在 Y 轴上具有相同单位的条形图?