values property

set values (List<int> values)

Implementation

set values(List<int> values) {
  final is64bit = _prop._model.type == OBXPropertyType.Long;
  final ptr =
      is64bit ? malloc<Int64>(values.length) : malloc<Int32>(values.length);
  try {
    for (var i = 0; i < values.length; i++) {
      if (is64bit) {
        (ptr as Pointer<Int64>)[i] = values[i];
      } else {
        (ptr as Pointer<Int32>)[i] = values[i];
      }
    }
    if (_alias == null) {
      checkObx(is64bit
          ? C.query_param_int64s(_query._ptr, _entityId, _prop._model.id.id,
              ptr as Pointer<Int64>, values.length)
          : C.query_param_int32s(_query._ptr, _entityId, _prop._model.id.id,
              ptr as Pointer<Int32>, values.length));
    } else {
      withNativeString(
          _alias!,
          (Pointer<Char> cAlias) => checkObx(is64bit
              ? C.query_param_alias_int64s(
                  _query._ptr, cAlias, ptr as Pointer<Int64>, values.length)
              : C.query_param_alias_int32s(_query._ptr, cAlias,
                  ptr as Pointer<Int32>, values.length)));
    }
  } finally {
    malloc.free(ptr);
  }
}