dart double type不允许固定格式

时间:2014-10-08 16:43:58

标签: dart double

我输出以下代码:

[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'。

我在这里缺少什么?

1 个答案:

答案 0 :(得分:1)

我很确定v.bankClosingBalance没有回复你的期望 我无法重现这个问题。