cloud_sync library

Classes

CloudSync<M, D>
Handles synchronization between local and cloud storage.
FetchingCloudMetadata
Indicates that metadata is being fetched from the cloud. Used to compare remote and local data.
FetchingLocalMetadata
Indicates that metadata is being fetched from local storage. Usually the initial step of the sync process.
InProgress
Indicates that a synchronization operation is already in progress. Prevents multiple sync operations from running simultaneously.
SavedToCloud
Indicates that data was successfully saved to the cloud.
SavedToLocal
Indicates that data was successfully saved to local storage.
SavingToCloud
Indicates that data is being saved to the cloud. Carries metadata about the item being uploaded.
SavingToLocal
Indicates that data is being saved to local storage. Carries metadata about the item being stored.
ScanningCloud
Indicates that the system is scanning the cloud for missing or outdated data. Ensures local storage is up-to-date with cloud changes.
ScanningLocal
Indicates that the system is scanning local storage for missing or outdated data. Ensures the cloud is up-to-date with local changes.
SerializableSyncAdapter<M, D>
Abstract base class for a synchronization adapter with serialization capabilities.
SerializableSyncMetadata
A serializable version of SyncMetadata for encoding/decoding purposes, typically used for saving to or reading from storage like JSON or databases.
SerializableSyncMetadataAdapter<M extends SyncMetadata, D>
A synchronization adapter with support for metadata serialization.
SyncAdapter<M, D>
Base class for synchronization adapters for specific data sources.
SyncCancelled
State representing a cancelled sync operation.
SyncCompleted
Indicates that synchronization completed successfully.
SyncError
Indicates that an error occurred during synchronization. Includes the error and its associated stack trace.
SyncMetadata
A model class representing metadata used for synchronization.
SyncMetadataAdapter<M extends SyncMetadata, D>
A base class for synchronization adapters that manage metadata.
SyncState
Base class for all synchronization states. Represents the current status of the sync process.

Enums

SyncStrategy
An enumeration that defines the different types of synchronization strategies.

Typedefs

FetchDetail<M, D> = FutureOr<D> Function(M metadata)
A function type that fetches a detailed data object based on metadata.
FetchMetadataList<M> = FutureOr<List<M>> Function()
A function type that fetches a list of metadata objects from a data source.
GetMetadataId<M> = String Function(M metadata)
A function type that retrieves a unique identifier for a given metadata object.
MetadataComparator<M> = FutureOr<bool> Function(M current, M other)
A function type that compares two metadata objects to determine their order.
SaveDetail<M, D> = FutureOr<void> Function(M metadata, D? detail)
A function type that saves a detailed data object to a storage location.
SyncProgressCallback = void Function(SyncState state)
A function type that reports synchronization progress via a SyncState.

Exceptions / Errors

SyncDisposedError
An error thrown when attempting to perform a sync operation on a disposed CloudSync object.