updateMenuItems method

Future<void> updateMenuItems(
  1. List<MenuItemModel> items
)

Implementation

Future<void> updateMenuItems(List<MenuItemModel> items) async {
  var menuDefModel =
      await menuDefRepository(appId: app.documentID)!.get(identifier);
  menuDefModel ??= await menuDef();
  List<MenuItemModel> newItems = [];
  if (menuDefModel.menuItems != null) {
    newItems.addAll(menuDefModel.menuItems!);
  }
  newItems.addAll(items);
  menuDefModel = menuDefModel.copyWith(menuItems: newItems);
  await menuDefRepository(appId: app.documentID)!.update(menuDefModel);
}