clean_core library
Clean Core is a package that contains the core functionality of the Clean Architecture.
Classes
- BaseError
- Base class for all errors in the app.
- CursorPagination
- DefaultHttp2Adapter
-
The default
HttpClientAdapter
for mobile platforms. This adapter will use the "dio_http2_adapter" HttpClient. - DefaultHttpAdapter
-
The default
HttpClientAdapter
for mobile platforms. This adapter will use the "dart:io" HttpClient. - DioExtensionMessages
- Dio extension messages
- NetworkError
- Network error
- NetworkInfo
- A class to check network status
- PagePagination
-
PaginatedResponse<
T> - Pagination
-
Result<
T> - A sealed class to represent the result of an operation.
- ServerError
- Base class for all errors in the app.
- UnAuthorizedError
- UnAuthorized error
- ValidationError
- Validation errors
Enums
- NetworkStatus
- Enum to represent network status
Extensions
- ApiExceptionDioX on DioException
-
Dio extension to convert
DioException
to ApiException
Functions
-
errorResult<
T> (BaseError error) → Result< T> - Returns a failed result with a BaseError.
-
handleCommonError<
T> (Object exception, StackTrace stacktrace) → ApiException - Handles common errors and returns the appropriate ApiException.
-
successResult<
T> (T data) → Result< T> -
Returns a successful result with a value of type
T
.
Typedefs
-
FromJson<
T> = T Function(Map< String, dynamic> json) - Callback for FromJson
-
FutureResult<
T> = Future< Result< T> > - Callback for Future that returns Result
-
OnSuccessCallback<
T> = T Function(Object data) - Callback for OnSuccess
-
PaginatedResult<
T> = Future< Result< PaginatedResponse< >T> > - Callback for Future that returns Result PaginatedResponse
Exceptions / Errors
- ApiException
- Base class for all API exceptions.
- BadCertificateException
- Exception thrown when API returns a 495 response.
- BadRequestException
- Exception thrown when API returns a 400 response.
- NetworkException
- Exception thrown when a network error occurs.
- NotFoundException
- Exception thrown when API returns a 404 response.
- ParseException
- Exception thrown when client is not able to parse data.
- RequestCancelledException
- Exception thrown when request is cancelled.
- ServerException
- Exception thrown when a server error occurs.
- TimeoutException
- Exception thrown when API returns a 408 response.
- UnAuthorizedException
- Exception thrown when a api is missing Authorization header.
- ValidationException
- Exception thrown when API returns a 422 response.