fromEntityPlus method Null safety

dynamic fromEntityPlus(
  1. ActionEntity? entity,
  2. {String? appId}
)

Implementation

static Future<ActionModel?> fromEntityPlus(ActionEntity? entity,
    {String? appId}) async {
  if (entity == null) return null;

  var mapper = ActionModelRegistry.registry()!.getMapper(entity.actionType);
  if (mapper != null) {
    var appRepo = appRepository();
    if (appRepo != null) {
      var app = await appRepo.get(entity.appID);
      if (app != null) {
        return mapper.fromEntityPlus(app, entity);
      } else {
        var appId = entity.appID;
        throw Exception(
            "ActionModel.fromEntityPlus App with id $appId not found");
      }
    }
  }

  return null;
}