copyOrDefault function
Implementation
MenuDefModel copyOrDefault(
String appId, String documentID, MenuDefModel? menuDefModel) {
if (menuDefModel == null) {
return newMenuDef(appId, documentID);
} else {
if (menuDefModel.menuItems == null) {
return menuDefModel.copyWith(menuItems: []);
} else {
return menuDefModel.copyWith(menuItems: List.of(menuDefModel.menuItems!));
}
}
}