where method Null safety

void where(
  1. Expression<bool> predicate
)

Applies the predicate as the where clause, which will be used to filter results.

The clause should only refer to columns defined in one of the tables specified during SimpleSelectStatement.join.

With the example of a todos table which refers to categories, we can write something like

final query = select(todos)
.join([
  leftOuterJoin(categories, categories.id.equalsExp(todos.category)),
])
..where(todos.name.like("%Important") & categories.name.equals("Work"));

Implementation

void where(Expression<bool> predicate) {
  if (whereExpr == null) {
    whereExpr = Where(predicate);
  } else {
    whereExpr = Where(whereExpr!.predicate & predicate);
  }
}