deleteItem method

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

Implementation

@override
GridModel deleteItem(GridModel 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;
}