fromEntity static method

Future<DialogModel?> fromEntity(
  1. String documentID,
  2. DialogEntity? entity
)

Implementation

static Future<DialogModel?> fromEntity(
    String documentID, DialogEntity? entity) async {
  if (entity == null) return null;
  var counter = 0;
  return DialogModel(
    documentID: documentID,
    appId: entity.appId ?? '',
    title: entity.title,
    description: entity.description,
    bodyComponents: entity.bodyComponents == null
        ? null
        : List<BodyComponentModel>.from(
            await Future.wait(entity.bodyComponents!.map((item) {
            counter++;
            return BodyComponentModel.fromEntity(counter.toString(), item);
          }).toList())),
    backgroundOverride:
        await BackgroundModel.fromEntity(entity.backgroundOverride),
    layout: toDialogLayout(entity.layout),
    includeHeading: entity.includeHeading,
    conditions: await StorageConditionsModel.fromEntity(entity.conditions),
  );
}