fromEntity static method

Future<GridModel?> fromEntity(
  1. String documentID,
  2. GridEntity? entity
)

Implementation

static Future<GridModel?> fromEntity(
    String documentID, GridEntity? entity) async {
  if (entity == null) return null;
  var counter = 0;
  return GridModel(
    documentID: documentID,
    appId: entity.appId ?? '',
    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())),
    conditions: await StorageConditionsModel.fromEntity(entity.conditions),
  );
}