【发布时间】:2021-05-06 10:46:16
【问题描述】:
如果我不确定列表是否为空,我可以这样做
final something = myList?[0].property;
如果我知道myList 存在但不确定其中是否存在元素怎么办?
我需要手动检查 isNotEmpty 吗?
final something = myList[0]?.property;
说The receiver can't be null, so the null-aware operator '?.' is unnecessary.
【问题讨论】: