SyncConfig class

Full configuration for BedrockSync.

Every option has a sensible default — you can start with SyncConfig() and customize only what you need.

Constructors

SyncConfig({String databaseName = 'bedrock_sync.db', int databaseVersion = 1, int maxRetries = 3, RetryStrategy retryStrategy = RetryStrategy.exponential, Duration retryDelay = const Duration(seconds: 2), SyncTrigger syncTrigger = SyncTrigger.hybrid, Duration syncInterval = const Duration(minutes: 5), ConflictResolver conflictResolver = const LastWriteWinsResolver(), int batchSize = 50, bool enableLogging = false, Duration syncTimeout = const Duration(seconds: 30), Map<String, String> customHeaders = const {}, Future<bool> onBeforeSync()?, void onAfterSync(int syncedCount)?, void onError(Object error, StackTrace stackTrace)?, bool autoClearSynced = true, int? keepSyncedForDays = 7})
const

Properties

autoClearSynced bool
Automatically clean up synced operations after each sync.
final
batchSize int
Max operations to send in a single batch to the server
final
conflictResolver ConflictResolver
How to resolve data conflicts between local and server
final
customHeaders Map<String, String>
Optional custom HTTP headers for all sync requests
final
databaseName String
Name of the local SQLite database file
final
databaseVersion int
Database schema version (increment when you change schema)
final
enableLogging bool
Enable verbose logging for debugging
final
hashCode int
The hash code for this object.
no setterinherited
keepSyncedForDays int?
How many days to keep synced operations in the queue.
final
maxRetries int
Max number of retry attempts for failed operations
final
onAfterSync → void Function(int syncedCount)?
Called after each successful sync
final
onBeforeSync Future<bool> Function()?
Called before each sync — return false to cancel
final
onError → void Function(Object error, StackTrace stackTrace)?
Called when a sync error occurs
final
retryDelay Duration
Base delay duration for retries
final
retryStrategy RetryStrategy
Strategy for calculating retry delays
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
syncInterval Duration
Interval for SyncTrigger.onInterval or SyncTrigger.hybrid
final
syncTimeout Duration
How long before a sync operation times out
final
syncTrigger SyncTrigger
What triggers an automatic sync
final

Methods

copyWith({String? databaseName, int? databaseVersion, int? maxRetries, RetryStrategy? retryStrategy, Duration? retryDelay, SyncTrigger? syncTrigger, Duration? syncInterval, ConflictResolver? conflictResolver, int? batchSize, bool? enableLogging, Duration? syncTimeout, Map<String, String>? customHeaders, Future<bool> onBeforeSync()?, void onAfterSync(int syncedCount)?, void onError(Object error, StackTrace stackTrace)?, bool? autoClearSynced, int? keepSyncedForDays}) SyncConfig
Create a copy with overridden values
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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