httpPut method
Sends an HTTP PUT request with the given headers and body 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> httpPut(String endPoint, String json, [Map<String, String> headers = _defaultHeaders]) async {
if (this.isEmptyOrNull) return;
try {
final response = await http.put(Uri.http(this, endPoint), headers: headers, body: json);
return response.statusCode == 200
? convert.jsonDecode(response.body)
: print('Request failed with status: ${response.statusCode}.');
} on Exception catch (e) {
return Future.error(e);
}
}