fromEntityPlus static method

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

Implementation

static Future<AlbumModel?> fromEntityPlus(
    String documentID, AlbumEntity? entity,
    {String? appId}) async {
  if (entity == null) return null;

  var counter = 0;
  return AlbumModel(
    documentID: documentID,
    appId: entity.appId ?? '',
    albumEntries: entity.albumEntries == null
        ? null
        : List<AlbumEntryModel>.from(
            await Future.wait(entity.albumEntries!.map((item) {
            counter++;
            return AlbumEntryModel.fromEntityPlus(counter.toString(), item,
                appId: appId);
          }).toList())),
    description: entity.description,
    backgroundImage: await BackgroundModel.fromEntityPlus(
        entity.backgroundImage,
        appId: appId),
    conditions: await StorageConditionsModel.fromEntityPlus(entity.conditions,
        appId: appId),
  );
}