【发布时间】:2021-12-27 14:35:51
【问题描述】:
我开始使用 youtube 指南视频练习 Flutter todo app crud,代码如下:
但我的代码将此错误吹入 [ ]:
The method '[]' can't be unconditionally invoked because the receiver can be 'null'.
Try making the call conditional (using '?.') or adding a null check to the target ('!').
dart(unchecked_use_of_nullable_value)
我也尝试了用“!”修复它的建议,但它仍然是错误的。
我也尝试添加一个“?”修复它,它仍然是错误的
The receiver can't be null, so the null-aware operator '?.' is unnecessary.
Try replacing the operator '?.' with '.'.dart(invalid_null_aware_operator)
The getter '[' isn't defined for the type 'DataSnapshot'.
Try importing the library that defines '[', correcting the name to the name of an existing getter, or defining a getter or field named '['.dart(undefined_getter)
Expected an identifier.dart(missing_identifier)
【问题讨论】:
标签: flutter dart null sdk crud