fromEntity static method
Implementation
static Future<SectionModel?> fromEntity(
String documentID, SectionEntity? entity) async {
if (entity == null) return null;
var counter = 0;
return SectionModel(
documentID: documentID,
title: entity.title,
description: entity.description,
imagePositionRelative:
toRelativeImagePosition(entity.imagePositionRelative),
imageAlignment: toSectionImageAlignment(entity.imageAlignment),
imageWidth: entity.imageWidth,
links: entity.links == null
? null
: List<LinkModel>.from(await Future.wait(entity.links!.map((item) {
counter++;
return LinkModel.fromEntity(counter.toString(), item);
}).toList())),
);
}