diff --git a/lib/service/RocketService.dart b/lib/service/RocketService.dart index 2f43c91..bb69622 100644 --- a/lib/service/RocketService.dart +++ b/lib/service/RocketService.dart @@ -86,21 +86,18 @@ class RocketService { .asMap() .map((_, agency) => MapEntry(agency.id, agency)); - final result = []; - for (int i = 0; i < launchesContent.length; i++) { - final currentLaunch = launchesContent[i]; + return launchesContent.map((currentLaunch) { final requestedAgencyId = currentLaunch["lsp"]; final Agency resolvedAgency = resolvedAgenciesMap[requestedAgencyId]; - - result.add(RocketLaunch( + + return RocketLaunch( country: resolvedAgency.countryCode, launchCompany: resolvedAgency, name: currentLaunch["name"], date: currentLaunch["windowstart"], videoUrl: (currentLaunch["vidURLs"] ?? [null])[0], - )); - } - return result; + ); + }); } static Future getAgencyById(String id) async { @@ -116,4 +113,4 @@ class RocketService { countryCode: agency["countryCode"], ); } -} \ No newline at end of file +}