fromEntity static method

Future<MenuDefModel?> fromEntity(
  1. String documentID,
  2. MenuDefEntity? entity
)

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,
  );
}