fromMap static method

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

Implementation

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

  var bodyComponentsCurrentMemberFromMap = map['bodyComponentsCurrentMember'];
  List<LabelledBodyComponentEntity> bodyComponentsCurrentMemberList;
  if (bodyComponentsCurrentMemberFromMap != null) {
    bodyComponentsCurrentMemberList =
        (map['bodyComponentsCurrentMember'] as List<dynamic>)
            .map((dynamic item) => LabelledBodyComponentEntity.fromMap(
                item as Map,
                newDocumentIds: newDocumentIds)!)
            .toList();
  } else {
    bodyComponentsCurrentMemberList = [];
  }
  var bodyComponentsOtherMemberFromMap = map['bodyComponentsOtherMember'];
  List<LabelledBodyComponentEntity> bodyComponentsOtherMemberList;
  if (bodyComponentsOtherMemberFromMap != null) {
    bodyComponentsOtherMemberList =
        (map['bodyComponentsOtherMember'] as List<dynamic>)
            .map((dynamic item) => LabelledBodyComponentEntity.fromMap(
                item as Map,
                newDocumentIds: newDocumentIds)!)
            .toList();
  } else {
    bodyComponentsOtherMemberList = [];
  }
  var itemColorFromMap = map['itemColor'];
  if (itemColorFromMap != null) {
    itemColorFromMap =
        RgbEntity.fromMap(itemColorFromMap, newDocumentIds: newDocumentIds);
  }
  var selectedItemColorFromMap = map['selectedItemColor'];
  if (selectedItemColorFromMap != null) {
    selectedItemColorFromMap = RgbEntity.fromMap(selectedItemColorFromMap,
        newDocumentIds: newDocumentIds);
  }
  var backgroundOverrideFromMap = map['backgroundOverride'];
  if (backgroundOverrideFromMap != null) {
    backgroundOverrideFromMap = BackgroundEntity.fromMap(
        backgroundOverrideFromMap,
        newDocumentIds: newDocumentIds);
  }
  var conditionsFromMap = map['conditions'];
  if (conditionsFromMap != null) {
    conditionsFromMap = StorageConditionsEntity.fromMap(conditionsFromMap,
        newDocumentIds: newDocumentIds);
  }

  return FeedMenuEntity(
    appId: map['appId'],
    description: map['description'],
    bodyComponentsCurrentMember: bodyComponentsCurrentMemberList,
    bodyComponentsOtherMember: bodyComponentsOtherMemberList,
    itemColor: itemColorFromMap,
    selectedItemColor: selectedItemColorFromMap,
    backgroundOverride: backgroundOverrideFromMap,
    feedFrontId: map['feedFrontId'],
    conditions: conditionsFromMap,
  );
}