and static method

Expression<bool> and(
  1. Iterable<Expression<bool>> predicates, {
  2. Expression<bool> ifEmpty = const Constant(true),
})

Chains all predicates together into a single expression that will evaluate to true iff all of the predicates evaluates to true.

The ifEmpty value will be used when no predicates have been passed to or. By default, true is returned.

Implementation

static Expression<bool> and(
  Iterable<Expression<bool>> predicates, {
  Expression<bool> ifEmpty = const Constant(true),
}) {
  if (predicates.isEmpty) {
    return ifEmpty;
  }

  return predicates.reduce((value, element) => value & element);
}