buildErrorResponse function Null safety

ParseResponse buildErrorResponse(
  1. ParseResponse response,
  2. ParseNetworkResponse apiResponse
)

Handles any errors returned in response

Implementation

ParseResponse buildErrorResponse(
    ParseResponse response, ParseNetworkResponse apiResponse) {
  final Map<String, dynamic> responseData = json.decode(apiResponse.data);
  response.error = ParseError(
      code: responseData[keyCode], message: responseData[keyError].toString());
  response.statusCode = responseData[keyCode];
  return response;
}