# fromEntity method Null safety

dynamic fromEntity(

1. ActionEntity? entity

)

## Implementation

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

      var mapper = ActionModelRegistry.registry()!.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;
    }