fromMap static method

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

Implementation

static GridEntity? 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 conditionsFromMap = map['conditions'];
  if (conditionsFromMap != null) {
    conditionsFromMap = StorageConditionsEntity.fromMap(conditionsFromMap,
        newDocumentIds: newDocumentIds);
  }

  return GridEntity(
    appId: map['appId'],
    description: map['description'],
    bodyComponents: bodyComponentsList,
    gridViewId: map['gridViewId'],
    conditions: conditionsFromMap,
  );
}