get method
Implementation
Future<dynamic> get(
String baseUrl, String api, Map<String, String>? headers) async {
var uri = Uri.parse(baseUrl + api);
try {
var response = await http
.get(uri, headers: headers)
.timeout(Duration(seconds: TIME_OUT_DURATION));
return _processResponse(response);
} on SocketException {
throw FetchDataException('No internet connection', uri.toString());
} on TimeoutException {
throw ApiNotRespondingException(
'Api taking too long to response', uri.toString());
}
}