我已经在使用该值之前已经进行了零检查
I already have a null check before using the value but it still give me error
您可以在其后面放置!,以表明您确定它不能为空,因此,就像
!
for (final value in widget.details.data.productPriceObjs!) {
您不喜欢使用!一样,您可以以
var objects = widget.details.data.productPriceObjs; if (objects != null) { for (final value in objects) { } }
某种方式编写编译器当检查中没有“嵌套”时,它很好
You can put an ! behind it to indicate you are sure it can't be null, so like
!
If you don't like using ! you can alternatively write
Somehow the compiler is fine with it when there isn't "nesting" in the check
put !在widget.details.data.productpriceobjs后面标记,以确保编译该值不为NULL,
widget.details.data.productpriceobjs
以获取有关NULL安全的更多详细信息在这里阅读
Put ! mark behind widget.details.data.productPriceObjs to make sure to compiler that this value is not null
widget.details.data.productPriceObjs
For more details about null safety read here
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(2)
您可以在其后面放置
!
,以表明您确定它不能为空,因此,就像您不喜欢使用
!
一样,您可以以某种方式编写编译器当检查中没有“嵌套”时,它很好
You can put an
!
behind it to indicate you are sure it can't be null, so likeIf you don't like using
!
you can alternatively writeSomehow the compiler is fine with it when there isn't "nesting" in the check
put
!
在widget.details.data.productpriceobjs
后面标记,以确保编译该值不为NULL,以获取有关NULL安全的更多详细信息在这里阅读
Put
!
mark behindwidget.details.data.productPriceObjs
to make sure to compiler that this value is not nullFor more details about null safety read here