analyzeAndParseResponse function

Map<String, dynamic>? analyzeAndParseResponse(
  1. Response response
)

Implementation

Map<String, dynamic>? analyzeAndParseResponse(http.Response response) {
  final Xml2Json xml2json = Xml2Json();

  xml2json.parse(response.body);
  final String content = xml2json.toParker();
  final result = json.decode(content);

  if (response.statusCode == 200) {
    return result;
  }

  final String? errorMessage = translateErrorMessage(result);

  throw SimpleError(errorMessage);
}