# fromEntity method Null safety

dynamic fromEntity(

1. String documentID,
2. FaderEntity? entity

)

## Implementation

    static Future<FaderModel?> fromEntity(
        String documentID, FaderEntity? entity) async {
      if (entity == null) return null;
      var counter = 0;
      return FaderModel(
        documentID: documentID,
        appId: entity.appId ?? '',
        description: entity.description,
        animationMilliseconds: entity.animationMilliseconds,
        imageSeconds: entity.imageSeconds,
        items: entity.items == null
            ? null
            : List<ListedItemModel>.from(
                await Future.wait(entity.items!.map((item) {
                counter++;
                return ListedItemModel.fromEntity(counter.toString(), item);
              }).toList())),
        background: await BackgroundModel.fromEntity(entity.background),
        conditions: await StorageConditionsModel.fromEntity(entity.conditions),
      );
    }