deleteItem method

  1. @override
PresentationModel deleteItem(
  1. PresentationModel model,
  2. BodyComponentModel deleteItem
)
override

Implementation

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