copyWith<E extends DatumEntityInterface> method
DatumConfig<E>
copyWith<E extends DatumEntityInterface>({
- Duration? autoSyncInterval,
- bool? autoStartSync,
- Duration? syncTimeout,
- DatumConflictResolver<
E> ? defaultConflictResolver, - UserSwitchStrategy? defaultUserSwitchStrategy,
- Future<
String?> initialUserId()?, - bool? enableLogging,
- SyncDirection? defaultSyncDirection,
- int? schemaVersion,
- List<
Migration> ? migrations, - DatumSyncExecutionStrategy? syncExecutionStrategy,
- MigrationErrorHandler? onMigrationError,
- DatumSyncRequestStrategy? syncRequestStrategy,
- DatumErrorRecoveryStrategy? errorRecoveryStrategy,
- Duration? remoteEventDebounceTime,
- Duration? changeCacheDuration,
- DatumSyncOptions<
E> ? defaultSyncOptions, - int? maxChangeCacheSize,
- Duration? changeCacheCleanupInterval,
- int? remoteSyncBatchSize,
- int? remoteStreamBatchSize,
- int? progressEventFrequency,
- LogLevel? logLevel,
- bool? enablePerformanceLogging,
- Duration? performanceLogThreshold,
- Map<
String, LogSampler> ? logSamplers, - SyncDirectionResolver? syncDirectionResolver,
- ColdStartConfig? coldStartConfig,
- DeleteBehavior? deleteBehavior,
Implementation
DatumConfig<E> copyWith<E extends DatumEntityInterface>({
Duration? autoSyncInterval,
bool? autoStartSync,
Duration? syncTimeout,
DatumConflictResolver<E>? defaultConflictResolver,
UserSwitchStrategy? defaultUserSwitchStrategy,
Future<String?> Function()? initialUserId,
bool? enableLogging,
SyncDirection? defaultSyncDirection,
int? schemaVersion,
List<Migration>? migrations,
DatumSyncExecutionStrategy? syncExecutionStrategy,
MigrationErrorHandler? onMigrationError,
DatumSyncRequestStrategy? syncRequestStrategy,
DatumErrorRecoveryStrategy? errorRecoveryStrategy,
Duration? remoteEventDebounceTime,
Duration? changeCacheDuration,
DatumSyncOptions<E>? defaultSyncOptions,
int? maxChangeCacheSize,
Duration? changeCacheCleanupInterval,
int? remoteSyncBatchSize,
int? remoteStreamBatchSize,
int? progressEventFrequency,
LogLevel? logLevel,
bool? enablePerformanceLogging,
Duration? performanceLogThreshold,
Map<String, LogSampler>? logSamplers,
SyncDirectionResolver? syncDirectionResolver,
ColdStartConfig? coldStartConfig,
DeleteBehavior? deleteBehavior,
}) {
return DatumConfig<E>(
autoSyncInterval: autoSyncInterval ?? this.autoSyncInterval,
autoStartSync: autoStartSync ?? this.autoStartSync,
syncTimeout: syncTimeout ?? this.syncTimeout,
// Only copy the resolver if the new type E is assignable from the old type T.
// This is safe when copyWith is called without a new generic type.
// This is safe when copyWith is called without a new generic type.
defaultConflictResolver: defaultConflictResolver ?? (this.defaultConflictResolver is DatumConflictResolver<E> ? this.defaultConflictResolver as DatumConflictResolver<E> : null),
defaultUserSwitchStrategy: defaultUserSwitchStrategy ?? this.defaultUserSwitchStrategy,
initialUserId: initialUserId ?? this.initialUserId,
enableLogging: enableLogging ?? this.enableLogging,
defaultSyncDirection: defaultSyncDirection ?? this.defaultSyncDirection,
schemaVersion: schemaVersion ?? this.schemaVersion,
migrations: migrations ?? this.migrations,
syncExecutionStrategy: syncExecutionStrategy ?? this.syncExecutionStrategy,
onMigrationError: onMigrationError ?? this.onMigrationError,
syncRequestStrategy: syncRequestStrategy ?? this.syncRequestStrategy,
errorRecoveryStrategy: errorRecoveryStrategy ?? this.errorRecoveryStrategy,
remoteEventDebounceTime: remoteEventDebounceTime ?? this.remoteEventDebounceTime,
changeCacheDuration: changeCacheDuration ?? this.changeCacheDuration,
defaultSyncOptions: defaultSyncOptions ?? (this.defaultSyncOptions is DatumSyncOptions<E> ? this.defaultSyncOptions as DatumSyncOptions<E> : null),
maxChangeCacheSize: maxChangeCacheSize ?? this.maxChangeCacheSize,
changeCacheCleanupInterval: changeCacheCleanupInterval ?? this.changeCacheCleanupInterval,
remoteSyncBatchSize: remoteSyncBatchSize ?? this.remoteSyncBatchSize,
remoteStreamBatchSize: remoteStreamBatchSize ?? this.remoteStreamBatchSize,
progressEventFrequency: progressEventFrequency ?? this.progressEventFrequency,
logLevel: logLevel ?? this.logLevel,
enablePerformanceLogging: enablePerformanceLogging ?? this.enablePerformanceLogging,
performanceLogThreshold: performanceLogThreshold ?? this.performanceLogThreshold,
logSamplers: logSamplers ?? this.logSamplers,
syncDirectionResolver: syncDirectionResolver ?? this.syncDirectionResolver,
coldStartConfig: coldStartConfig ?? this.coldStartConfig,
deleteBehavior: deleteBehavior ?? this.deleteBehavior,
);
}