fromEntity static method

Future<ActionModel?> fromEntity(
  1. ActionEntity? entity
)

Implementation

static Future<ActionModel?> fromEntity(ActionEntity? entity) async {
  if (entity == null) return null;

  var mapper = Apis.apis().getActionModelApi().getMapper(entity.actionType);
  if (mapper != null) {
    var app = await appRepository()!.get(entity.appID);

    if (app != null) {
      return mapper.fromEntity(app, entity);
    } else {
      var appId = entity.appID;
      throw Exception("ActionModel.fromEntity App with id $appId not found");
    }
  }

  return null;
}