copyWith method

SyncPolicy copyWith({
  1. SyncBehavior? onWifi,
  2. SyncBehavior? onCellular,
  3. SyncBehavior? onMetered,
  4. SyncBehavior? onOffline,
  5. SyncBehavior? onCharging,
  6. int? batchSize,
  7. Duration? batchInterval,
  8. int? lowBatteryThreshold,
  9. SyncBehavior? lowBatteryBehavior,
  10. Duration? minSyncInterval,
  11. Duration? maxLocationAge,
  12. bool? preferWifi,
  13. bool? foregroundOnly,
})

Creates a copy with the given fields replaced.

Implementation

SyncPolicy copyWith({
  SyncBehavior? onWifi,
  SyncBehavior? onCellular,
  SyncBehavior? onMetered,
  SyncBehavior? onOffline,
  SyncBehavior? onCharging,
  int? batchSize,
  Duration? batchInterval,
  int? lowBatteryThreshold,
  SyncBehavior? lowBatteryBehavior,
  Duration? minSyncInterval,
  Duration? maxLocationAge,
  bool? preferWifi,
  bool? foregroundOnly,
}) {
  return SyncPolicy(
    onWifi: onWifi ?? this.onWifi,
    onCellular: onCellular ?? this.onCellular,
    onMetered: onMetered ?? this.onMetered,
    onOffline: onOffline ?? this.onOffline,
    onCharging: onCharging ?? this.onCharging,
    batchSize: batchSize ?? this.batchSize,
    batchInterval: batchInterval ?? this.batchInterval,
    lowBatteryThreshold: lowBatteryThreshold ?? this.lowBatteryThreshold,
    lowBatteryBehavior: lowBatteryBehavior ?? this.lowBatteryBehavior,
    minSyncInterval: minSyncInterval ?? this.minSyncInterval,
    maxLocationAge: maxLocationAge ?? this.maxLocationAge,
    preferWifi: preferWifi ?? this.preferWifi,
    foregroundOnly: foregroundOnly ?? this.foregroundOnly,
  );
}