fromEntity static method

Future<WorkflowActionModel?> fromEntity(
  1. WorkflowActionEntity? entity
)
override

Implementation

static Future<WorkflowActionModel?> fromEntity(
    WorkflowActionEntity? entity) async {
  if (entity == null) return null;
  if (entity.appID == null) {
    throw Exception('entity WorkflowActionModel.appID is null');
  }
  var app = await appRepository()!.get(entity.appID);
  if (app != null) {
    return WorkflowActionModel(
      app,
      conditions: await DisplayConditionsModel.fromEntity(entity.conditions),
    );
  } else {
    throw Exception('App with ${entity.appID!} not found');
  }
}