OAuth2Response.fromHttpResponse constructor
OAuth2Response.fromHttpResponse(
- Response response
Implementation
factory OAuth2Response.fromHttpResponse(http.Response response) {
OAuth2Response resp;
var defMap = {'http_status_code': response.statusCode};
if (response.body != '') {
resp = OAuth2Response.fromMap({...jsonDecode(response.body), ...defMap});
} else {
resp = OAuth2Response.fromMap(defMap);
}
return resp;
/*
OAuth2Response resp;
if (response.statusCode != 404) {
if (response.body != '') {
resp = OAuth2Response.fromMap({
...jsonDecode(response.body),
...{'httpStatusCode': response.statusCode}
});
} else {
resp = OAuth2Response();
}
} else {
// resp = OAuth2Response();
resp = OAuth2Response.errorResponse();
}
return resp;
*/
}