fromMap static method

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

Implementation

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

  var bodyComponentsFromMap = map['bodyComponents'];
  List<BodyComponentEntity> bodyComponentsList;
  if (bodyComponentsFromMap != null) {
    bodyComponentsList = (map['bodyComponents'] as List<dynamic>)
        .map((dynamic item) => BodyComponentEntity.fromMap(item as Map,
            newDocumentIds: newDocumentIds)!)
        .toList();
  } else {
    bodyComponentsList = [];
  }
  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 PageEntity(
    appId: map['appId'],
    description: map['description'],
    title: map['title'],
    appBarId: map['appBarId'],
    drawerId: map['drawerId'],
    endDrawerId: map['endDrawerId'],
    homeMenuId: map['homeMenuId'],
    bodyComponents: bodyComponentsList,
    backgroundOverride: backgroundOverrideFromMap,
    layout: map['layout'],
    gridViewId: map['gridViewId'],
    conditions: conditionsFromMap,
  );
}