throwIfFailed method

void throwIfFailed()

Throws a generic Exception if the response is not successful.

Implementation

void throwIfFailed() {
  if (!isSuccessful) {
    throw Exception('Request failed with status $statusCode');
  }
}