get method
Implementation
Future<dynamic> get(String endpoint) async {
Map<String, String> headers = {
"Content-Type": "application/json",
};
if (apiKey != null) {
headers["Authorization"] = "Bearer $apiKey";
}
try {
final response = await http.get(
Uri.parse('$baseUrl/$endpoint'),
headers: headers,
);
return _handleResponse(response);
} catch (e) {
if (kDebugMode) {
print('Error in GET request: $e');
}
throw ApiException(500, 'Network or server error occurred');
}
}