ApiError.fromResponse constructor

ApiError.fromResponse(
  1. Response rawResponse
)

Implementation

factory ApiError.fromResponse(dio.Response rawResponse) {
  Map<String, dynamic> response = Map<String, dynamic>.from(rawResponse.data);
  return ApiError(
    code: rawResponse.statusCode!,
    message: response['message'].runtimeType == List
        ? response['message'][0]
        : response['message'].toString(),
  );
}