diff --git a/lib/pages/exchange_view/exchange_coin_selection/exchange_currency_selection_view.dart b/lib/pages/exchange_view/exchange_coin_selection/exchange_currency_selection_view.dart index 78afc54c0..c2b5acfc0 100644 --- a/lib/pages/exchange_view/exchange_coin_selection/exchange_currency_selection_view.dart +++ b/lib/pages/exchange_view/exchange_coin_selection/exchange_currency_selection_view.dart @@ -107,6 +107,7 @@ class _ExchangeCurrencySelectionViewState if (widget.pairedTicker == null) { return await _getCurrencies(); } + await ExchangeDataLoadingService.instance.initDB(); List currencies = await ExchangeDataLoadingService .instance.isar.currencies .where() @@ -153,6 +154,7 @@ class _ExchangeCurrencySelectionViewState } Future> _getCurrencies() async { + await ExchangeDataLoadingService.instance.initDB(); final currencies = await ExchangeDataLoadingService.instance.isar.currencies .where() .filter() diff --git a/lib/services/exchange/exchange_data_loading_service.dart b/lib/services/exchange/exchange_data_loading_service.dart index 6b34fd438..47bbefe79 100644 --- a/lib/services/exchange/exchange_data_loading_service.dart +++ b/lib/services/exchange/exchange_data_loading_service.dart @@ -196,6 +196,9 @@ class ExchangeDataLoadingService { } Future _loadChangeNowCurrencies() async { + if (_isar == null) { + await initDB(); + } final exchange = ChangeNowExchange.instance; final responseCurrencies = await exchange.getAllCurrencies(false); if (responseCurrencies.value != null) { @@ -325,6 +328,9 @@ class ExchangeDataLoadingService { // } Future loadMajesticBankCurrencies() async { + if (_isar == null) { + await initDB(); + } final exchange = MajesticBankExchange.instance; final responseCurrencies = await exchange.getAllCurrencies(false); @@ -347,6 +353,9 @@ class ExchangeDataLoadingService { } Future loadTrocadorCurrencies() async { + if (_isar == null) { + await initDB(); + } final exchange = TrocadorExchange.instance; final responseCurrencies = await exchange.getAllCurrencies(false);