init prefs before doing any network calls

This commit is contained in:
julian 2022-10-18 10:36:25 -06:00
parent e1e9cb7126
commit cd0fdad1f6
3 changed files with 3 additions and 6 deletions

View file

@ -207,6 +207,7 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
didLoad = true;
await DB.instance.init();
await _prefs.init();
_notificationsService = ref.read(notificationsProvider);
_nodeService = ref.read(nodeServiceChangeNotifierProvider);
@ -223,7 +224,6 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
tradesService: _tradesService,
prefs: _prefs,
);
await _prefs.init();
ref.read(priceAnd24hChangeNotifierProvider).start(true);
await _wallets.load(_prefs);
loadingCompleter.complete();

View file

@ -7,9 +7,8 @@ import 'package:http/http.dart';
import 'package:stackwallet/hive/db.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/logger.dart';
import 'package:tuple/tuple.dart';
import 'package:stackwallet/utilities/prefs.dart';
import 'package:tuple/tuple.dart';
class PriceAPI {
static const refreshInterval = 60;

View file

@ -19,9 +19,7 @@ class PriceService extends ChangeNotifier {
Tuple2<Decimal, double> getPrice(Coin coin) => _cachedPrices[coin]!;
PriceService(this.baseTicker) {
start(true);
}
PriceService(this.baseTicker);
Future<void> updatePrice() async {
final priceMap =