fromEntity static method

Future<WorkflowModel?> fromEntity(
  1. String documentID,
  2. WorkflowEntity? entity
)

Implementation

static Future<WorkflowModel?> fromEntity(
    String documentID, WorkflowEntity? entity) async {
  if (entity == null) return null;
  var counter = 0;
  return WorkflowModel(
    documentID: documentID,
    name: entity.name,
    workflowTask: entity.workflowTask == null
        ? null
        : List<WorkflowTaskModel>.from(
            await Future.wait(entity.workflowTask!.map((item) {
            counter++;
            return WorkflowTaskModel.fromEntity(counter.toString(), item);
          }).toList())),
    appId: entity.appId ?? '',
  );
}