deleteItem method

  1. @override
BookletModel deleteItem(
  1. BookletModel model,
  2. SectionModel deleteItem
)
override

Implementation

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