fromEntity static method

Future<AlbumModel?> fromEntity(
  1. String documentID,
  2. AlbumEntity? entity
)

Implementation

static Future<AlbumModel?> fromEntity(
    String documentID, AlbumEntity? entity) 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.fromEntity(counter.toString(), item);
          }).toList())),
    description: entity.description,
    backgroundImage: await BackgroundModel.fromEntity(entity.backgroundImage),
    conditions: await StorageConditionsModel.fromEntity(entity.conditions),
  );
}