import 'dart:convert'; import 'package:http/http.dart' as http; class APIClient { final String _baseUrl = 'http://andio.eu:8888/api/'; Future get(String endPoint, String param) async { final url = _baseUrl + endPoint + param; final response = await http.get(url, headers: {'Content-Type': 'application/json'}); if(response.statusCode == 200) { return utf8.decode(response.bodyBytes); } else { throw Exception("Unable to perform HTTP request!"); } } Future post(String endPoint, String body) async { final url = _baseUrl + endPoint; print(" ------------ http/post endpoint $endPoint body $body"); final response = await http.post(url, headers: {'Content-Type': 'application/json'}, body: body ); print(" ------------ response: " + response.body.toString()); return response.body; } }