getMissionManifest static method
Fetches the mission manifest for the perseverance rover from NASA's API using manifest endpoint
Implementation
static Future<Map<String, dynamic>> getMissionManifest() async {
// URL for the mission manifest API
String url =
'https://api.nasa.gov/mars-photos/api/v1/manifests/perseverance?api_key=${await NasaApi.getApiKey()}';
// Making a GET request to the API
final response = await get(Uri.parse(url));
// Decoding the JSON response if the request is successful
if (response.statusCode == 200) {
return json.decode(response.body);
} else {
// Returning an empty map if the request fails
return {};
}
}