findIds method

List<int> findIds()

Like find, but returns just the IDs of the objects.

Returns a list of IDs of matching objects. An empty array if no objects match.

IDs can later be used to Box.get objects.

This is very efficient as no objects are created.

Implementation

List<int> findIds() {
  final idArrayPtr = checkObxPtr(C.query_find_ids(_ptr), 'find ids');
  try {
    final idArray = idArrayPtr.ref;
    final ids = idArray.ids;
    return List.generate(idArray.count, (i) => ids[i], growable: false);
  } finally {
    C.id_array_free(idArrayPtr);
  }
}