updateAssetsAt method

CollectionPatch updateAssetsAt(
  1. int index,
  2. AssetPatch patch(
    1. AssetPatch
    )
)

Implementation

CollectionPatch updateAssetsAt(
  int index,
  AssetPatch Function(AssetPatch) patch,
) {
  patchMap[Collection$.assets] = (List<dynamic> list) {
    var updatedList = List<Asset>.from(list);
    if (index >= 0 && index < updatedList.length) {
      updatedList[index] = patch(AssetPatch())
          .applyTo(updatedList[index] as Asset);
    }
    return updatedList;
  };
  return this;
}