handleResponse method

  1. @override
Map<String, dynamic>? handleResponse(
  1. dynamic response
)
override

Implementation

@override
Map<String, dynamic>? handleResponse(response) {
  try {
    if (response is Response) {
      if (response.statusCode == 200 && response.data != null) {
        return jsonDecode(response.data);
      }

      // handle status code
      throw response.statusCode.handleException();
    }
    // Invalid response type
    throw InvalidResponseDataException();
  } catch (e) {
    debugPrint('ResponseHandlerDioImpl | handleResponse| Catch | error: $e');
    throw RestApiExceptionHandler.handleException(e);
  }
}