From 0e0cdfd1597de0e616c03d875255317c05377ec3 Mon Sep 17 00:00:00 2001 From: NIK Date: Wed, 3 Jul 2024 12:35:10 +0800 Subject: [PATCH] some logic fixes to make this compile --- .../shared_use_cases/get_token_models_use_case.dart | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/domain-shared/shared_use_cases/get_token_models_use_case.dart b/lib/domain-shared/shared_use_cases/get_token_models_use_case.dart index 22d7c8518..646c6987d 100644 --- a/lib/domain-shared/shared_use_cases/get_token_models_use_case.dart +++ b/lib/domain-shared/shared_use_cases/get_token_models_use_case.dart @@ -1,3 +1,5 @@ +import 'dart:async'; + import 'package:collection/collection.dart'; import 'package:dynamic_parallel_queue/dynamic_parallel_queue.dart'; import 'package:seeds/datasource/remote/api/stat_repository.dart'; @@ -83,8 +85,8 @@ class GetTokenModelsUseCase extends InputUseCase, TokenModelSel List theseTokens = []; /// verify token contract on chain and get contract precision - loadData(token) async { - TokenModel? tm = TokenModel.fromJson(token as Map); + FutureOr loadData(token) async { + final TokenModel? tm = TokenModel.fromJson(token as Map); if (tm != null) { await _statRepository.getTokenStat(tokenContract: tm.contract, symbol: tm.symbol).then( (stats) async { @@ -95,7 +97,11 @@ class GetTokenModelsUseCase extends InputUseCase, TokenModelSel print("supply: $supply"); } }, - ).catchError((dynamic error) => _statRepository.mapHttpError(error)); + ).catchError((dynamic error) { + // This entire code here is really funky - Nik + _statRepository.mapHttpError(error); + return null; // Ensure the handler returns a value assignable to FutureOr + }); } }