checkResponse static method

Map<String, dynamic> checkResponse(
  1. String response, {
  2. bool checkBody = true,
})

Checks the response of the api call and returns the body, it throws a MBException if it encounters an error.

  • Parameters:
    • response: The response string that needs to be checked.
    • checkBody: If true this function checks if in the response there's a "body" value, otherwise it skips this check, true by default.
  • Returns a Map<String, dynamic> object which is the body of the response.

Implementation

static Map<String, dynamic> checkResponse(
  String response, {
  bool checkBody = true,
}) =>
    checkResponseForType<Map<String, dynamic>>(
      response,
      checkBody: checkBody,
    );