synquill library

Classes

ApiAdapterBase<TModel extends SynquillDataModel<TModel>>
Abstract interface for REST API adapters used by SynquillStorage.
BackgroundSyncManager
Background sync manager for handling platform-specific background tasks.
BackgroundTransformer
The default Transformer for Dio.
BaseOptions
A set of base settings for each Dio(). BaseOptions and Options will be merged into one RequestOptions before sending the requests. See Options.compose.
BasicApiAdapter<TModel extends SynquillDataModel<TModel>>
Concrete implementation of ApiAdapterBase using Dio for HTTP requests.
CancelToken
Controls cancellation of Dio's requests.
CascadeDeleteRelation
Represents a cascade delete relationship between models
DatabaseProvider
Global database provider for the synced data storage system
DependencyResolver
Manages dependency resolution for hierarchical sync ordering.
Dio
Dio enables you to make HTTP requests easily.
DioMixin
ErrorInterceptorHandler
The handler for interceptors to handle error occurred during the request.
FieldSelector<T>
Base class for typed field selectors.
FilterCondition<T>
Typed version of FilterCondition that provides compile-time type safety.
FilterValue<T>
Base class for typed filter condition values
ForeignKeyRelation
Represents a foreign key relationship where this model references another
ForeignKeyUpdateService
Service for updating foreign key references when model IDs change.
FormData
A class to create readable "multipart/form-data" streams. It can be used to submit forms and file uploads to http server.
FusedTransformer
A Transformer that has a fast path for decoding UTF8-encoded JSON. If the response is utf8-encoded JSON and no custom decoder is specified in the RequestOptions, this transformer is significantly faster than the default SyncTransformer and the BackgroundTransformer. This improvement is achieved by using a fused Utf8Decoder and JsonDecoder to decode the response, which is faster than decoding the utf8-encoded JSON in two separate steps, since Dart uses a special fast decoder for this case. See https://github.com/dart-lang/sdk/blob/5b2ea0c7a227d91c691d2ff8cbbeb5f7f86afdb9/sdk/lib/_internal/vm/lib/convert_patch.dart#L40
Headers
The headers class for requests and responses.
HttpClientAdapter
HttpAdapter is a bridge between Dio and HttpClient.
IdConflictResolver
Service for resolving ID conflicts during server ID negotiation.
IdNegotiationService<T extends SynquillDataModel<T>>
Service for managing server ID negotiation without modifying user models
Indexed
Annotation to mark a field for database indexing. This will create a database index on the annotated field to improve query performance.
Interceptor
Interceptor helps to deal with RequestOptions, Response, and DioException during the lifecycle of a request before it reaches users.
Interceptors
A Queue-Model list for Interceptors.
InterceptorsWrapper
A helper class to create interceptors in ease.
Level
Levels to control logging output. Logging can be enabled to include all levels above certain Level. Levels are ordered using an integer value Level.value. The predefined Level constants below are sorted as follows (in descending order): Level.SHOUT, Level.SEVERE, Level.WARNING, Level.INFO, Level.CONFIG, Level.FINE, Level.FINER, Level.FINEST, and Level.ALL.
ListParam<T>
Indicates a param being used as queries or form data, and how does it gets formatted.
ListValue<T>
List value for inList/notInList operations
Logger
Use a Logger to log debug messages.
LogInterceptor
LogInterceptor is used to print logs during network requests. It should be the last interceptor added, otherwise modifications by following interceptors will not be logged. This is because the execution of interceptors is in the order of addition.
LogRecord
A log entry representation used to propagate information from Logger to individual handlers.
ManyToOne
Annotation to mark a field as a many-to-one relation. This creates a foreign key constraint in the database.
ModelInfoRegistryProvider
Global provider for model metadata including cascade delete relationships
MultipartFile
An upload content that is a part of MultipartRequest. This doesn't need to correspond to a physical file.
NativeDatabase
A drift database implementation based on dart:ffi, running directly in a Dart VM or an AOT compiled Dart/Flutter application.
NetworkTask<T>
Represents a network operation task that can be executed by the RequestQueue.
NoValue<T>
No value for isNull/isNotNull operations
OneToMany
Annotation to mark a field as a one-to-many relation. This field should be of type List
Options
The configuration for a single request. BaseOptions and Options will be merged into one RequestOptions before sending the requests. See Options.compose.
PaginationParams
Represents pagination parameters.
PluralizationUtils
Utility class for English pluralization rules
QueryParams
Typed version of QueryParams that provides compile-time safety.
QueuedInterceptor
Interceptor in queue.
QueuedInterceptorsWrapper
A helper class to create QueuedInterceptor in ease.
QueueStats
Statistics for a request queue.
RedirectRecord
A record that records the redirection happens during requests, including status code, request method, and the location.
RepositoryChange<T>
A change in a repository. This is emitted through the repository's change stream.
RequestInterceptorHandler
The handler for interceptors to handle before the request has been sent.
RequestOptions
The internal request option class that is the eventual result after BaseOptions and Options are composed.
RequestQueue
A queue for managing sequential execution of network operations.
RequestQueueManager
Manages multiple request queues for different types of API operations.
Response<T>
The Response class contains the payload (could be transformed) that respond from the request, and other information of the response.
ResponseBody
The response wrapper class for adapters.
ResponseInterceptorHandler
The handler for interceptors to handle after respond.
RetryExecutor
Manages retry logic for sync queue operations with exponential backoff.
ServerIdMetadata
Metadata for tracking server ID negotiation process
SingleValue<T>
Single value for most filter operations
SortCondition<T>
Typed version of SortCondition that provides compile-time safety for field names.
SyncDetails
Holds detailed synchronization information for a model instance.
SyncQueueDao
Data Access Object for managing sync queue items.
SyncStatusConverter
Drift type converter for SyncStatus enum
SyncTransformer
If you want to custom the transformation of request/response data, you can provide a Transformer by your self, and replace the transformer by setting the Dio.transformer.
SynqillDatabaseVersion
Annotation to specify the database schema version. This annotation can be placed anywhere in the application code where SynquillStorage is initialized. If no annotation is present, the default version is 1.
SynquillDataModel<T extends SynquillDataModel<T>>
Base class for all data models that are to be managed by SynquillStorage.
SynquillRepository
An annotation to mark a class as a data model for which a Drift table and repository should be generated.
SynquillRepositoryBase<T extends SynquillDataModel<T>>
Base class for synchronized repositories.
SynquillRepositoryProvider
Provides a centralized mechanism for registering and retrieving repository instances. This allows for dependency injection of repositories, primarily for testing and decoupling model logic from concrete repository implementations.
SynquillStorage
Main class for interacting with the synced data storage.
SynquillStorageConfig
Base class for synced data storage configuration.
Transformer
Transformer allows changes to the request/response data before it is sent/received to/from the server.

Enums

DataLoadPolicy
Enum representing different data store policies.
DataSavePolicy
Enum representing different data store policies.
DioExceptionType
The exception enumeration indicates what type of exception has happened during requests.
FileAccessMode
The file access mode when downloading a file, corresponds to a subset of dart:io::FileMode.
FilterOperator
Enum representing different comparison operators for filtering.
IdGenerationStrategy
Strategy for ID generation in models.
IdNegotiationStatus
Status of ID negotiation process for server-generated IDs.
ListFormat
Specifies the array format (a single parameter with multiple parameter or multiple parameters with the same name). and the separator for array items.
QueueType
Queue types for different API operations.
RepositoryChangeType
Represents a change to a repository. This is used for notifying listeners about changes to the data.
ResponseType
Indicates which transformation should be applied to the response data.
SortDirection
Enum representing sort directions.
SyncOperation
Represents an operation to be performed on a sync queue.
SyncStatus
Enum representing the synchronization status of a record

Mixins

BaseDaoMixin<T>
Base mixin for common DAO operations to reduce code duplication
DioClientMixin<TModel extends SynquillDataModel<TModel>>
Mixin that provides Dio client management functionality for API adapters.
ErrorHandlingMixin<TModel extends SynquillDataModel<TModel>>
Mixin that provides error handling functionality for API adapters.
HttpExecutionMixin<TModel extends SynquillDataModel<TModel>>
Mixin that provides HTTP execution functionality for API adapters.
OptionsMixin
The mixin class for options that provides common attributes.
RepositoryDeleteOperations<T extends SynquillDataModel<T>>
Mixin providing delete and cascade delete operations for repositories.
RepositoryHelpersMixin<T extends SynquillDataModel<T>>
Mixin that provides common repository operations to reduce code duplication
RepositoryLocalOperations<T extends SynquillDataModel<T>>
Mixin providing abstract local storage operations for repositories.
RepositoryQueryOperations<T extends SynquillDataModel<T>>
Mixin providing query operations for repositories.
RepositoryRemoteOperations<T extends SynquillDataModel<T>>
Mixin providing remote operations for repositories.
RepositorySaveOperations<T extends SynquillDataModel<T>>
Mixin providing save operations for repositories.
RepositoryServerIdMixin<T extends SynquillDataModel<T>>
Mixin providing server ID negotiation capabilities to repositories.
RepositorySyncOperations<T extends SynquillDataModel<T>>
Mixin providing sync operations and queue management for repositories.
ResponseParsingMixin<TModel extends SynquillDataModel<TModel>>
Mixin that provides response parsing functionality for API adapters.

Extensions

FieldSelectorExtensions on FieldSelector<T>
Extension methods for FieldSelector that provide compile-time type safety for creating filter conditions.
Switch on Stream<T>
A utility to take events from the most recent sub stream returned by a callback.
SynquillDataModelExtensions on SynquillDataModel<T>
Runtime extensions for SynquillDataModel instances.

Constants

defaultLevel → const Level
The default Level.

Properties

hierarchicalLoggingEnabled bool
Whether to allow fine-grain logging and configuration of loggers in a hierarchy.
getter/setter pair
recordStackTraceAtLevel Level
Automatically record stack traces for any message of this level or above.
getter/setter pair

Functions

defaultDioExceptionReadableStringBuilder(DioException e) String
The default implementation of building a readable string of DioException.
generateCuid() String
Generates a new CUID (Collision-resistant Universal Identifier).

Typedefs

DatabaseSetup = void Function(Database database)
Signature of a function that can perform setup work on a database before drift is fully ready.
DefaultTransformer = SyncTransformer
DioError = DioException
DioError describes the exception info when a request failed.
DioErrorType = DioExceptionType
Deprecated in favor of DioExceptionType and will be removed in future major versions.
DioExceptionReadableStringBuilder = String Function(DioException e)
The readable string builder's signature of DioException.readableStringBuilder.
DioMediaType = MediaType
The type (alias) for specifying the content-type of the MultipartFile.
GetColumnForFieldFunction = String? Function(String tableName, String fieldName)
Function type for getting column name using DAO's getColumnForField method
HeaderForEachCallback = void Function(String name, List<String> values)
The signature that iterates header fields.
InterceptorErrorCallback = void Function(DioException error, ErrorInterceptorHandler handler)
The signature of Interceptor.onError.
InterceptorSendCallback = void Function(RequestOptions options, RequestInterceptorHandler handler)
The signature of Interceptor.onRequest.
InterceptorSuccessCallback = void Function(Response response, ResponseInterceptorHandler handler)
The signature of Interceptor.onResponse.
IsolateSetup = FutureOr<void> Function()
Signature of a function that can perform setup work on the isolate before opening the database.
JsonDecodeCallback = FutureOr Function(String)
The callback definition for decoding a JSON string.
JsonEncodeCallback = FutureOr<String> Function(Object)
The callback definition for encoding a JSON object.
ProgressCallback = void Function(int count, int total)
The type of a progress listening callback when sending or receiving data.
RepositoryFactory<M extends SynquillDataModel<M>> = SynquillRepositoryBase<M> Function(GeneratedDatabase db)
Defines a factory function for creating repository instances. The factory takes a SynquillDatabase instance and returns a repository of type SynquillRepositoryBase<M>. M is the model type.
RequestEncoder = FutureOr<List<int>> Function(String request, RequestOptions options)
The type of a request encoding callback.
ResponseDecoder = FutureOr<String?> Function(List<int> responseBytes, RequestOptions options, ResponseBody responseBody)
The type of a response decoding callback.
SqliteResolver = FutureOr<Sqlite3> Function()
Signature of a function that obtains an instance of Sqlite3 bindings.
ValidateStatus = bool Function(int? status)
The type of a response status code validate callback.

Exceptions / Errors

ApiError
Base class for errors originating from the remote API interaction.
ApiException
General API exception for HTTP errors.
ApiExceptionGone
General API exception for HTTP errors.
ApiExceptionNotFound
General API exception for HTTP errors.
AuthenticationException
Thrown when authentication is required but not provided.
AuthorizationException
Thrown when the authenticated user lacks permission for an operation.
ConflictException
Thrown when there's a conflict with the current state of the resource.
DioException
DioException describes the exception info when a request failed.
DoubleFallbackException
Thrown when both update and create operations fail with 404. This indicates an API configuration issue and should not use exponential backoff retry logic.
IdConflictException
Exception thrown when ID conflicts cannot be resolved.
ModelNoLongerExistsException
Thrown when a model no longer exists locally but a sync operation is pending. This typically happens when a model is deleted locally while a sync operation for that model is still in the retry queue.
NetworkException
Thrown when a network connection error occurs.
NotFoundException
Thrown when a repository can't find a requested item.
NotNullableError<T>
A TypeError thrown by _checkNotNullable.
OfflineException
Thrown when an operation requires an online connection
ServerException
Thrown when the server encounters an internal error.
SqliteException
Thrown by sqlite methods.
SynquillStorageException
Base class for all exceptions thrown by the synquill package.
UnsupportedFreezedUnionError
Thrown when an operation is attempted on a Freezed union type that is not supported for unions.
ValidationException
Thrown when validation fails on the server side.