copyWith method

FilterOptionGroup copyWith({
  1. FilterOption? imageOption,
  2. FilterOption? videoOption,
  3. FilterOption? audioOption,
  4. bool? containsPathModified,
  5. bool? containsLivePhotos,
  6. bool? onlyLivePhotos,
  7. DateTimeCond? createTimeCond,
  8. DateTimeCond? updateTimeCond,
  9. List<OrderOption>? orders,
})

Returns a new FilterOptionGroup with the same options as this one, but with some options replaced.

Parameters:

  • imageOption: New image filter option. Defaults to the current object's option.
  • videoOption: New video filter option. Defaults to the current object's option.
  • audioOption: New audio filter option. Defaults to the current object's option.
  • containsPathModified: Whether to include results with modified paths. Defaults to the same as the current object.
  • containsLivePhotos: Whether to include live photos. Defaults to the same as the current object.
  • onlyLivePhotos: Whether to include only live photos. Defaults to the same as the current object.
  • createTimeCond: Date and time conditions for filtering creation time. Defaults to the same as the current object.
  • updateTimeCond: Date and time conditions for filtering update time. Defaults to the same as the current object.
  • orders: Sorting options for the results. Defaults to the same as the current object.

Returns a new FilterOptionGroup object with the specified options.

Implementation

FilterOptionGroup copyWith({
  FilterOption? imageOption,
  FilterOption? videoOption,
  FilterOption? audioOption,
  bool? containsPathModified,
  bool? containsLivePhotos,
  bool? onlyLivePhotos,
  DateTimeCond? createTimeCond,
  DateTimeCond? updateTimeCond,
  List<OrderOption>? orders,
}) {
  imageOption ??= _map[AssetType.image];
  videoOption ??= _map[AssetType.video];
  audioOption ??= _map[AssetType.audio];
  containsPathModified ??= this.containsPathModified;
  containsLivePhotos ??= this.containsLivePhotos;
  onlyLivePhotos ??= this.onlyLivePhotos;
  createTimeCond ??= this.createTimeCond;
  updateTimeCond ??= this.updateTimeCond;
  orders ??= this.orders;

  final FilterOptionGroup result = FilterOptionGroup()
    ..setOption(AssetType.image, imageOption!)
    ..setOption(AssetType.video, videoOption!)
    ..setOption(AssetType.audio, audioOption!)
    ..containsPathModified = containsPathModified
    ..containsLivePhotos = containsLivePhotos
    ..onlyLivePhotos = onlyLivePhotos
    ..createTimeCond = createTimeCond
    ..updateTimeCond = updateTimeCond
    ..orders.addAll(orders);

  return result;
}