addItem method

  1. @override
BookletModel addItem(
  1. BookletModel model,
  2. SectionModel newItem
)
override

Implementation

@override
BookletModel addItem(BookletModel model, SectionModel newItem) {
  List<SectionModel> newItems =
      model.sections == null ? [] : model.sections!.map((e) => e).toList();
  newItems.add(newItem);
  var newModel = model.copyWith(sections: newItems);
  return newModel;
}