fromEntity static method
Implementation
static Future<MenuDefModel?> fromEntity(
String documentID, MenuDefEntity? entity) async {
if (entity == null) return null;
var counter = 0;
return MenuDefModel(
documentID: documentID,
appId: entity.appId ?? '',
name: entity.name,
menuItems: entity.menuItems == null
? null
: List<MenuItemModel>.from(
await Future.wait(entity.menuItems!.map((item) {
counter++;
return MenuItemModel.fromEntity(counter.toString(), item);
}).toList())),
admin: entity.admin,
);
}