# fromMap method Null safety

FaderEntity? fromMap(

1. Object? o,
2. {Map<String, String>? newDocumentIds}

)

## Implementation

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

      var itemsFromMap = map['items'];
      List<ListedItemEntity> itemsList;
      if (itemsFromMap != null) {
        itemsList = (map['items'] as List<dynamic>)
            .map((dynamic item) => ListedItemEntity.fromMap(item as Map,
                newDocumentIds: newDocumentIds)!)
            .toList();
      } else {
        itemsList = [];
      }
      var backgroundFromMap = map['background'];
      if (backgroundFromMap != null) {
        backgroundFromMap = BackgroundEntity.fromMap(backgroundFromMap,
            newDocumentIds: newDocumentIds);
      }
      var conditionsFromMap = map['conditions'];
      if (conditionsFromMap != null) {
        conditionsFromMap = StorageConditionsEntity.fromMap(conditionsFromMap,
            newDocumentIds: newDocumentIds);
      }

      return FaderEntity(
        appId: map['appId'],
        description: map['description'],
        animationMilliseconds:
            int.tryParse(map['animationMilliseconds'].toString()),
        imageSeconds: int.tryParse(map['imageSeconds'].toString()),
        items: itemsList,
        background: backgroundFromMap,
        conditions: conditionsFromMap,
      );
    }