httpGet method
Sends an HTTP GET request with the given headers to the given URL, which can
be a Uri or a String.
endPoint
- end point of current url
example:
current string is www.mydomain.com
endpoint param - user
result request -> www.mydomain.com/user
Implementation
Future<dynamic> httpGet(String endPoint) async {
if (this.isEmptyOrNull) return;
try {
final response = await http.get(Uri.http(this, endPoint));
return response.statusCode == 200
? convert.jsonDecode(response.body)
: print('Request failed with status: ${response.statusCode}.');
} on Exception catch (e) {
return Future.error(e);
}
}