getCountries method
Get available countries
Implementation
@override
Future<List<Map<String, dynamic>>> getCountries() async {
try {
final response = await http.get(
Uri.parse('$_baseApiUrl/countries'),
headers: getHeaders(),
);
if (response.statusCode == 200) {
final List<dynamic> countriesJson = jsonDecode(response.body);
return countriesJson.cast<Map<String, dynamic>>();
} else {
throw Exception('Failed to get countries: ${response.statusCode}');
}
} catch (e) {
throw Exception('Error getting countries: $e');
}
}