OAuth2Response.fromHttpResponse constructor

OAuth2Response.fromHttpResponse(
  1. 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;
}