eachUntil method

void eachUntil(
  1. Query2UntilCallback<A, B> callback
)

Implementation

void eachUntil(Query2UntilCallback<A, B> callback) {
  final driver = Query.chooseDriver(_driverCandidates);
  final driverIsA = identical(driver, _a);
  final driverIsB = identical(driver, _b);
  _world.beginQuery(this);
  try {
    for (var i = 0; i < driver.length; i++) {
      final entityIndex = driver.entityIndexAt(i);

      final aDense = driverIsA ? i : _a.denseIndexOf(entityIndex);
      if (aDense < 0) continue;

      final bDense = driverIsB ? i : _b.denseIndexOf(entityIndex);
      if (bDense < 0) continue;

      if (!Query.passesFilters(entityIndex, _withStores, _withoutStores)) {
        continue;
      }

      if (!callback(
        _world.entities.resolve(entityIndex),
        _a.valueAt(aDense),
        _b.valueAt(bDense),
      )) {
        return;
      }
    }
  } finally {
    _world.endQuery();
  }
}