fromEntityPlus static method

Future<FaderModel?> fromEntityPlus(
  1. String documentID,
  2. FaderEntity? entity, {
  3. String? appId,
})

Implementation

static Future<FaderModel?> fromEntityPlus(
    String documentID, FaderEntity? entity,
    {String? appId}) 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.fromEntityPlus(counter.toString(), item,
                appId: appId);
          }).toList())),
    background:
        await BackgroundModel.fromEntityPlus(entity.background, appId: appId),
    conditions: await StorageConditionsModel.fromEntityPlus(entity.conditions,
        appId: appId),
  );
}