requestMap function
Future
requestMap({
- required String endpoint,
- required MapResponseHandler responseHandler,
- dynamic params,
Implementation
Future requestMap({required String endpoint, required MapResponseHandler responseHandler, params}) async {
var url = Uri.http('$localhostApiUrl:3000', endpoint, params);
Response response = await get(url, headers: {"content-type": "application/json"});
if (response.statusCode < 400) {
if (kDebugMode) {
print(response.body);
}
return responseHandler(response.body);
}
throw Exception(errorFromJson(response.body).error);
}