get function
Implementation
Future<http.Response> get(String baseAddress, String endpoint,
{Map<String, String?>? queryParameters}) async {
var response;
try {
var uri;
baseAddress = baseAddress.replaceFirst("https://", "");
if (queryParameters != null) {
uri = Uri.https(baseAddress, '$API_VERSION$endpoint', queryParameters);
} else {
uri = Uri.https(baseAddress, '$API_VERSION$endpoint');
}
response = await http.get(
uri,
headers: {
HttpHeaders.acceptHeader: 'application/json',
},
);
return returnResponseOrThrowException(response);
} on IOException {
throw NetworkException();
} catch (e) {
print(e);
return response;
}
}