fetchAllData method
Implementation
Future<List<dynamic>> fetchAllData(String endpoint) async {
final Uri url = Uri.parse('$rootApi$endpoint');
final response = await http.get(url);
if (response.statusCode == 200) {
return jsonDecode(response.body) as List<dynamic>;
} else {
throw Exception(
'Failed to fetch data. Status Code: ${response.statusCode}');
}
}