File tree Expand file tree Collapse file tree
lib/services/exchange/lets_exchange/models Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,7 +27,17 @@ class CoinInfo {
2727
2828 factory CoinInfo .fromJson (Map <String , dynamic > json) {
2929 final rawProfit = json["profit" ] as String ? ;
30- final rawExpiredAt = json["rate_id_expired_at" ] as int ? ;
30+
31+ final rawExpiredAt = json["rate_id_expired_at" ] is int
32+ ? json["rate_id_expired_at" ] as int
33+ : json["rate_id_expired_at" ] is String
34+ ? int .tryParse (json["rate_id_expired_at" ] as String )
35+ : null ;
36+
37+ final expiredAt = rawExpiredAt == null
38+ ? null
39+ : DateTime .fromMillisecondsSinceEpoch (rawExpiredAt);
40+
3141 return CoinInfo (
3242 minAmount: Decimal .parse (json["min_amount" ] as String ),
3343 maxAmount: Decimal .parse (json["max_amount" ] as String ),
@@ -36,9 +46,7 @@ class CoinInfo {
3646 profit: rawProfit == null ? null : Decimal .tryParse (rawProfit),
3747 withdrawalFee: Decimal .parse (json["withdrawal_fee" ] as String ),
3848 rateId: json["rate_id" ] as String ? ,
39- rateIdExpiredAt: rawExpiredAt == null
40- ? null
41- : DateTime .fromMillisecondsSinceEpoch (rawExpiredAt),
49+ rateIdExpiredAt: expiredAt,
4250 );
4351 }
4452
You can’t perform that action at this time.
0 commit comments