Fix exchange limits issue (#545)

* Allow nullable values from limits API

* Handle null values in SideShift limits API response
This commit is contained in:
Omar Hatem
2022-10-19 18:20:11 -04:00
committed by GitHub
parent c7ea9d52ee
commit a2dfbc6076
2 changed files with 4 additions and 4 deletions
@@ -85,8 +85,8 @@ class ChangeNowExchangeProvider extends ExchangeProvider {
final responseJSON = json.decode(response.body) as Map<String, dynamic>; final responseJSON = json.decode(response.body) as Map<String, dynamic>;
return Limits( return Limits(
min: responseJSON['minAmount'] as double, min: responseJSON['minAmount'] as double?,
max: responseJSON['maxAmount'] as double); max: responseJSON['maxAmount'] as double?);
} }
@override @override
@@ -192,8 +192,8 @@ class SideShiftExchangeProvider extends ExchangeProvider {
} }
final responseJSON = json.decode(response.body) as Map<String, dynamic>; final responseJSON = json.decode(response.body) as Map<String, dynamic>;
final min = double.parse(responseJSON['min'] as String); final min = double.tryParse(responseJSON['min'] as String? ?? '');
final max = double.parse(responseJSON['max'] as String); final max = double.tryParse(responseJSON['max'] as String? ?? '');
return Limits(min: min, max: max); return Limits(min: min, max: max);
} }