addItem method

  1. @override
GridModel addItem(
  1. GridModel model,
  2. BodyComponentModel newItem
)
override

Implementation

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