processResponse method Null safety

Map<String, dynamic> processResponse(
  1. Response response
)
inherited

Process response.

Returns a Map if the response has a valid status code. available API paths. Throws a VeryfiException if there is an error.

Implementation

Map<String, dynamic> processResponse(Response response) {
  final Map<String, dynamic> json = jsonDecode(response.body);
  if (response.statusCode == 200 || response.statusCode == 201) {
    return json;
  } else {
    throw VeryfiException(
        APIError.serverError, response.statusCode, json.toString());
  }
}