NetworkResponse<T>.withErrorRequest constructor

NetworkResponse<T>.withErrorRequest(
  1. DioException error
)

Implementation

NetworkResponse.withErrorRequest(dio.DioException error) {
  appDebugPrint("NetworkResponse.withErrorRequest: $error");
  try {
    data = null;
    status = false;
    dio.Response? response = error.response;
    responseData = response?.data;
    statusCode = response?.statusCode ?? 500;
    if (response?.data?['error'] is String) {
      this.msg = response?.data?['error'];
    }
  } catch (e) {
    appDebugPrint("NetworkResponse.withErrorRequest2: $e");
  }
}