allow null minimum amount in limits

OmarHatem committed Dec 1, 2022 at 22:37 UTC 091ac41ee276e8862a12af0b7362513270f88a84
1 file changed +4 -4
lib/view_model/exchange/exchange_view_model.dart
+4 -4
@@ -336,7 +336,7 @@ abstract class ExchangeViewModelBase with Store {
336 ? depositCurrency
337 : receiveCurrency;
338
339 - double lowestMin = double.maxFinite;
339 + double? lowestMin = double.maxFinite;
340 double? highestMax = 0.0;
341
342 for (var provider in selectedProviders) {
@@ -351,8 +351,8 @@ abstract class ExchangeViewModelBase with Store {
351 to: to,
352 isFixedRateMode: isFixedRateMode);
353
354 - if (tempLimits.min != null && tempLimits.min! < lowestMin) {
355 - lowestMin = tempLimits.min!;
354 + if (lowestMin != null && (tempLimits.min ?? -1) < lowestMin) {
355 + lowestMin = tempLimits.min;
356 }
357 if (highestMax != null && (tempLimits.max ?? double.maxFinite) > highestMax) {
358 highestMax = tempLimits.max;
@@ -362,7 +362,7 @@ abstract class ExchangeViewModelBase with Store {
362 }
363 }
364
365 - if (lowestMin < double.maxFinite) {
365 + if (lowestMin != double.maxFinite) {
366 limits = Limits(min: lowestMin, max: highestMax);
367
368 limitsState = LimitsLoadedSuccessfully(limits: limits);