【发布时间】:2021-02-27 19:44:24
【问题描述】:
Flutter 源文件多次包含类似这样的代码:
@override
double computeMinIntrinsicWidth(double height) {
if (child != null)
return child!.getMinIntrinsicWidth(height);
return 0.0;
}
请解释一下“!”。我在飞镖操作员列表中找不到它。
【问题讨论】:
-
可能类似于“空断言”运算符?
-
有条件成员访问运算符“?.”在飞镖中,但我问的是“!。”。
-
好的。我想也许代码中的某个地方有重载运算符“!”,所以 child!.getMinIntrinsicWidth(height) 实际上是 child.operator!().getMinIntrinsicWidth(height) ...
-
相关的 SO 问题? stackoverflow.com/questions/60068435