From 26af31b35ba796591acdbdabe9c8f4c55f16a57b Mon Sep 17 00:00:00 2001 From: sidhdhi canopas Date: Fri, 15 Nov 2024 10:41:40 +0530 Subject: [PATCH] handle potential error --- data/lib/service/match/match_service.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/data/lib/service/match/match_service.dart b/data/lib/service/match/match_service.dart index 5575e6d6..97e1e80e 100644 --- a/data/lib/service/match/match_service.dart +++ b/data/lib/service/match/match_service.dart @@ -565,8 +565,10 @@ class MatchService { final list = await Future.wait( teamList.map((matchPlayer) async { - final team = - teams.firstWhere((element) => element.id == matchPlayer.team_id); + final team = teams.firstWhere( + (element) => element.id == matchPlayer.team_id, + orElse: () => deActiveDummyTeamModel(matchPlayer.team_id), + ); final squad = await getPlayerListFromPlayerIds(matchPlayer.squad); return matchPlayer.copyWith(team: team, squad: squad);