wherePath method

Query<T> wherePath(
  1. Predicate predicate
)

Adds a typed Predicate from the PathField-based AST. Equivalent in semantics to where (AND'd with any other predicates), but introspectable: a future indexed executor can walk the tree and push eligible clauses to a secondary index, while where's closures stay opaque.

final overdue = await todos.query()
    .wherePath($Todo.done.eq(false))
    .wherePath($Todo.due.lt(DateTime.now()))
    .get();

// Or compose with .and / .or:
final urgent = await todos.query()
    .wherePath($Todo.done.eq(false).and($Todo.due.lt(soon)))
    .get();

Co-exists with where: both lists are evaluated, AND'd together. Use where for ad-hoc closures; reach for wherePath when you'd like the library to be able to optimise the predicate later.

Implementation

Query<T> wherePath(Predicate predicate) =>
    Query<T>._(_collection, _spec._withTypedPredicate(predicate));