fromMap static method

MenuDefEntity? fromMap(
  1. Object? o, {
  2. Map<String, String>? newDocumentIds,
})

Implementation

static MenuDefEntity? fromMap(Object? o,
    {Map<String, String>? newDocumentIds}) {
  if (o == null) return null;
  var map = o as Map<String, dynamic>;

  var menuItemsFromMap = map['menuItems'];
  List<MenuItemEntity> menuItemsList;
  if (menuItemsFromMap != null) {
    menuItemsList = (map['menuItems'] as List<dynamic>)
        .map((dynamic item) => MenuItemEntity.fromMap(item as Map,
            newDocumentIds: newDocumentIds)!)
        .toList();
  } else {
    menuItemsList = [];
  }

  return MenuDefEntity(
    appId: map['appId'],
    name: map['name'],
    menuItems: menuItemsList,
    admin: map['admin'],
  );
}