fromEntity static method

Future<TutorialModel?> fromEntity(
  1. String documentID,
  2. TutorialEntity? entity
)

Implementation

static Future<TutorialModel?> fromEntity(
    String documentID, TutorialEntity? entity) async {
  if (entity == null) return null;
  var counter = 0;
  return TutorialModel(
    documentID: documentID,
    appId: entity.appId ?? '',
    name: entity.name,
    title: entity.title,
    description: entity.description,
    tutorialEntries: entity.tutorialEntries == null
        ? null
        : List<TutorialEntryModel>.from(
            await Future.wait(entity.tutorialEntries!.map((item) {
            counter++;
            return TutorialEntryModel.fromEntity(counter.toString(), item);
          }).toList())),
    conditions: await StorageConditionsModel.fromEntity(entity.conditions),
  );
}