I輸出下面的代碼:鏢雙倍類型不允許固定的格式
[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)
但給我的錯誤:如果我使用double.parse周圍
Exception: Uncaught Error: type 'int' is not a subtype of type 'String' of 'value'.
還在說,除了用相同的「雙」。
我在這裏錯過了什麼?
'v.bankClosingBalance'返回什麼? – 2014-10-08 16:48:15
@GünterZöchbauer無論是一個null或一個雙。 class Month {double bankClosingBalance;/* ... * /} – khany 2014-10-08 20:04:07