fromHttpResponse static method
Implementation
static ApiCallResponse fromHttpResponse(
http.Response response,
bool returnBody,
bool decodeUtf8,
) {
var jsonBody;
try {
final responseBody = decodeUtf8 && returnBody
? const Utf8Decoder().convert(response.bodyBytes)
: response.body;
jsonBody = returnBody ? json.decode(responseBody) : null;
} catch (_) {}
return ApiCallResponse(
jsonBody,
response.headers,
response.statusCode,
response: response,
);
}