![](/img/trans.png)
[英]_TypeError (type 'Null' is not a subtype of type 'String') in flutter
[英]Flutter: _TypeError (type 'Null' is not a subtype of type 'String')
真正发生的是,您正在尝试使用一个值,即null
,但是Text
小部件需要一个string
,而不是null
。 这是您错误的根本原因。
您可以通过确保您的数据不是 null 来修复错误,或者您可以对可空数据使用 null 安全运算符。
例子:
Text(userData['name'] ?? 'name not found')
快乐编码:D
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.