我输出以下代码:
[v.bankClosingBalance, 0.00].firstWhere((value) => value != null)
并得到错误:
Exception: Uncaught Error: type 'double' is not a subtype of type 'String' of 'value'.
这很好,因为它告诉我是替身。问题是作为替身我应该能够做到:
[v.bankClosingBalance, 0.00].firstWhere((value) => value != null).toStringAsFixed(2)
但这给了我一个错误:
Exception: Uncaught Error: type 'int' is not a subtype of type 'String' of 'value'.
如果我在它周围使用double.parse,它仍然是一样的,除了用"double"。
我在这里错过了什么?
我很确定v.bankClosingBalance
不会返回您期望的结果
我没能重现这个问题。