find method

List<int> find({
  1. int? replaceNullWith,
})

Returns values of this property matching the query.

Results are in no particular order. Excludes null values unless you specify replaceNullWith.

Implementation

List<int> find({int? replaceNullWith}) {
  switch (_type) {
    case OBXPropertyType.Bool:
    case OBXPropertyType.Byte: // Int8
      final cDefault = replaceNullWith == null
          ? null
          : (malloc<Int8>()..value = replaceNullWith);
      return _find(
          C.query_prop_find_int8s,
          cDefault,
          (Pointer<OBX_int8_array> cItems) =>
              cItems.ref.items.asTypedList(cItems.ref.count).toList(),
          C.int8_array_free);
    case OBXPropertyType.Char:
    case OBXPropertyType.Short: // Int16
      final cDefault = replaceNullWith == null
          ? null
          : (malloc<Int16>()..value = replaceNullWith);
      return _find(
          C.query_prop_find_int16s,
          cDefault,
          (Pointer<OBX_int16_array> cItems) =>
              cItems.ref.items.asTypedList(cItems.ref.count).toList(),
          C.int16_array_free);
    case OBXPropertyType.Int: // Int32
      final cDefault = replaceNullWith == null
          ? null
          : (malloc<Int32>()..value = replaceNullWith);
      return _find(
          C.query_prop_find_int32s,
          cDefault,
          (Pointer<OBX_int32_array> cItems) =>
              cItems.ref.items.asTypedList(cItems.ref.count).toList(),
          C.int32_array_free);
    case OBXPropertyType.Long: // Int64
      final cDefault = replaceNullWith == null
          ? null
          : (malloc<Int64>()..value = replaceNullWith);
      return _find(
          C.query_prop_find_int64s,
          cDefault,
          (Pointer<OBX_int64_array> cItems) =>
              cItems.ref.items.asTypedList(cItems.ref.count).toList(),
          C.int64_array_free);
    default:
      throw UnsupportedError(
          'Property query: unsupported type (OBXPropertyType: $_type)');
  }
}