diff --git a/lib/Screens/team_details.dart b/lib/Screens/team_details.dart index c8280c4..aeca947 100644 --- a/lib/Screens/team_details.dart +++ b/lib/Screens/team_details.dart @@ -461,6 +461,7 @@ class TeamResults extends StatelessWidget { snapshot.data![index - 1][0], 5, ), + if (snapshot.data![index - 1].length > 1) DriverResultItem( snapshot.data![index - 1][1], 5, diff --git a/lib/api/ergast.dart b/lib/api/ergast.dart index 5911232..8f1326f 100644 --- a/lib/api/ergast.dart +++ b/lib/api/ergast.dart @@ -428,25 +428,26 @@ class _ErgastApiCalls { raceId: race['Circuit']['circuitId'], raceName: race['raceName'], ), - DriverResult( - race['Results'][1]['Driver']['driverId'], - race['Results'][1]['position'], - race['Results'][1]['number'], - race['Results'][1]['Driver']['givenName'], - race['Results'][1]['Driver']['familyName'], - race['Results'][1]['Driver']['code'], - race['Results'][1]['Constructor']['constructorId'], - race['Results'][1]['Time']?['time'] ?? 'DNF', - int.parse(race['Results'][1]['FastestLap']?['rank'] ?? '20') == 1 - ? true - : false, - race['Results'][1]['FastestLap']?['Time']['time'] ?? '00:00:00', - race['Results'][1]['FastestLap']?['rank'] ?? '20', - lapsDone: race['Results'][1]['laps'], - points: race['Results'][1]['points'], - raceId: race['Circuit']['circuitId'], - raceName: race['raceName'], - ), + if (race['Results'].length > 1) + DriverResult( + race['Results'][1]['Driver']['driverId'], + race['Results'][1]['position'], + race['Results'][1]['number'], + race['Results'][1]['Driver']['givenName'], + race['Results'][1]['Driver']['familyName'], + race['Results'][1]['Driver']['code'], + race['Results'][1]['Constructor']['constructorId'], + race['Results'][1]['Time']?['time'] ?? 'DNF', + int.parse(race['Results'][1]['FastestLap']?['rank'] ?? '20') == 1 + ? true + : false, + race['Results'][1]['FastestLap']?['Time']['time'] ?? '00:00:00', + race['Results'][1]['FastestLap']?['rank'] ?? '20', + lapsDone: race['Results'][1]['laps'], + points: race['Results'][1]['points'], + raceId: race['Circuit']['circuitId'], + raceName: race['raceName'], + ), ], ); } diff --git a/lib/helpers/convert_ergast_and_formula_one.dart b/lib/helpers/convert_ergast_and_formula_one.dart index d1ff128..9981e38 100644 --- a/lib/helpers/convert_ergast_and_formula_one.dart +++ b/lib/helpers/convert_ergast_and_formula_one.dart @@ -52,7 +52,7 @@ class Convert { 'mercedes': 'Mercedes', 'alpine': 'Alpine', 'mclaren': 'McLaren', - 'alphatauri': 'AlphaTauri', + 'rb': 'RB', 'aston_martin': 'Aston-Martin', 'williams': 'Williams', 'sauber': 'Kick-Sauber',