getMany method

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

Returns a list of ids.length Objects of type T, each corresponding to the location of its ID in ids. Non-existent IDs become null.

Pass growableResult: true for the resulting 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;
  });
}