fromMap static method

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

Implementation

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

  var imageIdNewDocmentId = map['imageId'];
  if ((newDocumentIds != null) && (imageIdNewDocmentId != null)) {
    var imageIdOldDocmentId = imageIdNewDocmentId;
    imageIdNewDocmentId = newRandomKey();
    newDocumentIds[imageIdOldDocmentId] = imageIdNewDocmentId;
  }
  var conditionsFromMap = map['conditions'];
  if (conditionsFromMap != null) {
    conditionsFromMap = StorageConditionsEntity.fromMap(conditionsFromMap,
        newDocumentIds: newDocumentIds);
  }

  return SimpleImageEntity(
    appId: map['appId'],
    description: map['description'],
    imageId: imageIdNewDocmentId,
    conditions: conditionsFromMap,
  );
}