deleteItem method

  1. @override
DocumentModel deleteItem(
  1. DocumentModel model,
  2. DocumentItemModel deleteItem
)
override

Implementation

@override
DocumentModel deleteItem(DocumentModel model, DocumentItemModel deleteItem) {
  var newItems = <DocumentItemModel>[];
  if (model.images != null) {
    for (var item in model.images!) {
      if (item != deleteItem) {
        newItems.add(item);
      }
    }
  }
  var newModel = model.copyWith(images: newItems);
  return newModel;
}