ErrorHandlingMixin<TModel extends SynquillDataModel<TModel>> mixin

Mixin that provides error handling functionality for API adapters.

Handles:

  • Mapping DioException to SynquillStorageException
  • Extracting validation errors from responses
  • HTTP status code specific error handling
Superclass constraints
Mixin applications

Properties

baseHeaders FutureOr<Map<String, String>>
HTTP headers applied to every request. Can be overridden in subclasses for model-specific headers.
no setterinherited
baseUrl Uri
Base URL for the API. Must be provided by concrete implementations. Example: Uri.parse('https://api.example.com/v1/')
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
headersWithContentType FutureOr<Map<String, String>>
HTTP headers for operations that send data (POST, PUT, PATCH). Includes Content-Type header for JSON data. Can be overridden in subclasses for model-specific headers.
no setterinherited
logger Logger
Logger instance for error handling.
no setter
pluralType String
Plural form of the entity name for collection endpoints.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type String
Logical entity name, singular.
no setterinherited

Methods

createOne(TModel model, {Map<String, String>? headers, Map<String, dynamic>? extra}) Future<TModel?>
Creates a new item on the remote API.
inherited
deleteOne(String id, {Map<String, String>? headers, Map<String, dynamic>? extra}) Future<void>
Deletes an item by its ID from the remote API.
inherited
findAll({Map<String, String>? headers, QueryParams? queryParams, Map<String, dynamic>? extra}) Future<List<TModel>>
Fetches all items from the remote API.
inherited
findOne(String id, {Map<String, String>? headers, QueryParams? queryParams, Map<String, dynamic>? extra}) Future<TModel?>
Fetches a single item by its ID from the remote API.
inherited
fromJson(Map<String, dynamic> json) → TModel
Converts a JSON map to an instance of the model TModel.
inherited
mapDioErrorToSynquillStorageException(DioException error) SynquillStorageException
Maps a DioException to the appropriate SynquillStorageException.
mergeHeaders(Map<String, String>? requestHeaders, {Map<String, dynamic>? extra}) FutureOr<Map<String, String>>
Merges base headers with request-specific headers.
inherited
mergeHeadersWithContentType(Map<String, String>? requestHeaders, {Map<String, dynamic>? extra}) FutureOr<Map<String, String>>
Merges headers with Content-Type for operations that send data.
inherited
methodForCreate({Map<String, dynamic>? extra}) String
HTTP method for creating a new entity. Default: 'POST'
inherited
methodForDelete({Map<String, dynamic>? extra}) String
HTTP method for deleting an entity. Default: 'DELETE'
inherited
methodForFind({QueryParams? queryParams, Map<String, dynamic>? extra}) String
HTTP method used by findOne / findAll operations. Default: 'GET'
inherited
methodForReplace({Map<String, dynamic>? extra}) String
HTTP method for full replacement. Default: 'PUT'
inherited
methodForUpdate({Map<String, dynamic>? extra}) String
HTTP method for partial updates. Default: 'PATCH'
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
queryParamsToHttpParams(QueryParams? queryParams) Map<String, String>
Converts QueryParams to HTTP query parameters.
inherited
replaceOne(TModel model, {Map<String, String>? headers, Map<String, dynamic>? extra}) Future<TModel?>
Replaces an existing item on the remote API with full replacement.
inherited
toJson(TModel model) Map<String, dynamic>
Converts a model instance to a JSON map for API requests.
inherited
toString() String
A string representation of this object.
inherited
updateOne(TModel model, {Map<String, String>? headers, Map<String, dynamic>? extra}) Future<TModel?>
Updates an existing item on the remote API using partial update.
inherited
urlForCreate({Map<String, dynamic>? extra}) FutureOr<Uri>
Constructs the URL for creating a new model instance.
inherited
urlForDelete(String id, {Map<String, dynamic>? extra}) FutureOr<Uri>
Constructs the URL for deleting a model instance.
inherited
urlForFindAll({QueryParams? queryParams, Map<String, dynamic>? extra}) FutureOr<Uri>
Constructs the URL for fetching all model instances.
inherited
urlForFindOne(String id, {QueryParams? queryParams, Map<String, dynamic>? extra}) FutureOr<Uri>
Constructs the URL for fetching/updating/deleting a single model instance.
inherited
urlForReplace(String id, {Map<String, dynamic>? extra}) FutureOr<Uri>
Constructs the URL for replacing an existing model instance.
inherited
urlForUpdate(String id, {Map<String, dynamic>? extra}) FutureOr<Uri>
Constructs the URL for updating an existing model instance.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited