getMany method

List<T?> getMany(
  1. List<int> ids, {
  2. bool growableResult = false,
})

Returns a list of Objects of type T, each located at the corresponding position of its ID in ids.

If an object does not exist, null is added to the list instead.

Set growableResult to true for the returned list to be growable.

Implementation

List<T?> getMany(List<int> ids, {bool growableResult = false}) {
  final result = List<T?>.filled(ids.length, null, growable: growableResult);
  if (ids.isEmpty) return result;
  return InternalStoreAccess.runInTransaction(_store, TxMode.read,
      (Transaction tx) {
    final cursor = tx.cursor(_entity);
    for (var i = 0; i < ids.length; i++) {
      final object = cursor.get(ids[i]);
      if (object != null) result[i] = object;
    }
    return result;
  });
}