CloudKitSyncEngine class final

Syncs the CloudKit private database of a container through Apple's CKSyncEngine.

The engine schedules fetches and sends, retries, pages, and listens for push notifications and account changes. The app decides what to send, how to apply fetched records, and how to resolve conflicts.

Requires iOS 17 or macOS 14. The app runs one engine at a time; starting an engine replaces the running one. Every method other than start acts on that one running native engine, whatever this instance's containerId is.

Constructors

CloudKitSyncEngine(String containerId)
Creates a CloudKitSyncEngine for containerId, such as iCloud.com.example.app.
const

Properties

containerId → String
CloudKit container identifier.
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

accountStatus() → Future<CloudKitAccountStatus>
The current iCloud account status of containerId, from CKContainer.accountStatus().
addPendingDatabaseChanges(List<CloudKitPendingDatabaseChange> changes) → Future<void>
Marks zone saves or deletes as pending.
addPendingRecordZoneChanges(List<CloudKitPendingRecordZoneChange> changes) → Future<void>
Marks changes as pending, so a later send asks for their records.
fetchChanges() → Future<void>
Fetches changes now rather than waiting for the engine's schedule. Completes after the fetched events are handled.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removePendingRecordZoneChanges(List<CloudKitPendingRecordZoneChange> changes) → Future<void>
Removes changes that no longer need sending.
sendChanges() → Future<void>
Sends pending changes now rather than waiting for the engine's schedule. Completes after the sent events are handled.
start({required CloudKitSyncDelegate delegate, required String? stateSerialization, List<String> excludedZoneNames = const []}) → Future<void>
Starts the engine from stateSerialization, the latest CloudKitStateUpdate the app saved, or from scratch when it is null.
stop() → Future<void>
Stops the engine and cancels its operations.
toString() → String
A string representation of this object.
inherited

Operators

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