getParserResponse<T> method

ParserResponse<T, E> getParserResponse<T>(
  1. Type type,
  2. ApiResponse<T>? response
)

Implementation

ParserResponse<T, E> getParserResponse<T>(
    Type type, ApiResponse<T>? response) {
  if (response == null) {
    return ParserResponseEntity(null, []);
  } else {
    if (response is ApiResponsePagination) {
      return ParserResponseWithPaginationEntity(
        response.data as T,
        (response as ApiResponsePagination).pagination,
        getErrors(type, response.errors ?? []),
      );
    } else {
      return ParserResponseEntity(
          response.data, getErrors(type, response.errors ?? []));
    }
  }
}