SynquillRepositoryBase<T extends SynquillDataModel<T>> class abstract

Base class for synchronized repositories.

This class provides the core functionality for repositories that synchronize data between a local database and a remote API.

Mixed-in types

Constructors

SynquillRepositoryBase.new(GeneratedDatabase db)
Creates a new synchronized repository.

Properties

apiAdapter ApiAdapterBase<T>
Gets the API adapter for this repository. This needs to be implemented by the concrete generated repository.
no setteroverride
canPerformBackgroundSync bool
Checks if the repository has access to required sync components.
no setterinherited
changeController StreamController<RepositoryChange<T>>
Gets the stream controller for emitting change events. This is used by the mixins to emit change events.
no setteroverride
changes Stream<RepositoryChange<T>>
A broadcast stream of RepositoryChange events that notifies listeners when a repository item is created, updated, deleted, or when an error occurs.
no setter
db GeneratedDatabase
The database connection.
final
defaultLoadPolicy DataLoadPolicy
Gets the default load policy from global configuration.
no setteroverride
defaultSavePolicy DataSavePolicy
Gets the default save policy from global configuration.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
localOnly bool
Whether this repository is local-only (no remote sync).
no setteroverride
log Logger
The logger for this repository.
latefinaloverride-getter
queueManager RequestQueueManager
Gets the queue manager for this repository. This is used by the mixins for sync operations.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

delete(String id, {DataSavePolicy? savePolicy, Map<String, dynamic>? extra, Map<String, String>? headers, Set<String>? deletionContext}) Future<void>
Deletes an item by its ID.
inherited
deleteFromLocal(String id) Future<void>
Deletes an item from local storage only and notifies listeners.
inherited
dispose() → void
Disposes of resources used by this repository.
enqueueImmediateSyncTask(SyncOperation operation, T item, String idempotencyKey, Map<String, String>? headers, Map<String, dynamic>? extra) Future<void>
Creates and enqueues a NetworkTask for immediate sync execution.
inherited
executeSyncOperation(SyncOperation operation, T item, Map<String, String>? headers, Map<String, dynamic>? extra) Future<void>
Executes a sync operation for background queue processing.
inherited
fetchAllFromLocal({QueryParams? queryParams}) Future<List<T>>
Fetches all items from the local database.
inherited
fetchAllFromLocalWithoutPendingSyncOps({QueryParams? queryParams}) Future<List<T>>
Fetches all items from the local database, excluding those with pending sync operations.
inherited
fetchAllFromRemote({QueryParams? queryParams, Map<String, dynamic>? extra, Map<String, String>? headers}) Future<List<T>>
Fetches all items from the remote API.
inherited
fetchFromLocal(String id, {QueryParams? queryParams}) Future<T?>
Fetches an item from the local database.
inherited
fetchFromRemote(String id, {QueryParams? queryParams, Map<String, dynamic>? extra, Map<String, String>? headers}) Future<T?>
Fetches an item from the remote API.
inherited
findAll({DataLoadPolicy? loadPolicy, QueryParams? queryParams, Map<String, dynamic>? extra, Map<String, String>? headers}) Future<List<T>>
Finds all items of this type.
inherited
findOne(String id, {DataLoadPolicy? loadPolicy, QueryParams? queryParams, Map<String, dynamic>? extra, Map<String, String>? headers}) Future<T?>
Finds an item by ID.
inherited
findOneOrFail(String id, {DataLoadPolicy? loadPolicy, QueryParams? queryParams, Map<String, dynamic>? extra, Map<String, String>? headers}) Future<T>
Finds an item by ID.
override
getSyncQueueStats() Map<QueueType, QueueStats>
Gets queue statistics for monitoring sync operations.
inherited
handleCascadeDeleteAfterGone(String id, {Map<String, dynamic>? extra, Map<String, String>? headers}) Future<void>
Handles cascade delete operations when a parent model is gone (HTTP 410).
inherited
isExistingItem(T item) Future<bool>
Checks if an item with the given ID exists in the local database. This is a placeholder and should be overridden by concrete repositories.
inherited
manageSyncQueueForSave(T item, SyncOperation operation, String idempotencyKey, Map<String, String>? headers, Map<String, dynamic>? extra) Future<int>
Manages sync queue entries for save operations.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
processBackgroundSync(T item, SyncOperation operation, Map<String, String>? headers, Map<String, dynamic>? extra) Future<void>
Processes background sync operations for localFirst saves.
inherited
processPendingSyncTasks({bool forceSync = false}) Future<void>
Triggers immediate processing of pending sync tasks.
inherited
removeFromLocalIfExists(String id) Future<void>
Removes an item from the local database if it exists.
inherited
save(T item, {DataSavePolicy? savePolicy, Map<String, dynamic>? extra, Map<String, String>? headers, bool updateTimestamps = true}) Future<T>
Saves an item.
inherited
saveToLocal(T item, {Map<String, dynamic>? extra}) Future<void>
Saves an item to the local database.
inherited
toString() String
A string representation of this object.
inherited
truncateLocal() Future<void>
Truncates (clears) all local storage for this model type.
inherited
truncateLocalStorage() Future<void>
Truncates (clears) all local storage for this model type.
inherited
tryImmediateSyncAndCleanup(SyncOperation operation, T item, String idempotencyKey, int syncQueueId, Map<String, String>? headers, Map<String, dynamic>? extra) Future<void>
Attempts immediate sync execution and removes queue entry on success.
inherited
updateLocalCache(List<T> items) Future<void>
Updates the local cache with remote data.
inherited
watchAll({QueryParams? queryParams}) Stream<List<T>>
Watches all items in the local repository.
inherited
watchAllFromLocal({QueryParams? queryParams}) Stream<List<T>>
Watches all items from the local database.
inherited
watchFromLocal(String id, {QueryParams? queryParams}) Stream<T?>
Watches a single item from the local database by its ID.
inherited
watchOne(String id, {DataLoadPolicy? loadPolicy, QueryParams? queryParams}) Stream<T?>
Watches a single item by its ID.
inherited

Operators

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