buildAnd function

Expression<bool> buildAnd(
  1. Iterable<Expression<bool>> iterable
)

This function takes an iterable of boolean expressions and builds an AND expression from them. If the iterable is empty, it returns a constant true expression. Otherwise, it reduces the iterable to a single expression using the & operator, and checks if the result equals true.

Implementation

Expression<bool> buildAnd(Iterable<Expression<bool>> iterable) {
  if (iterable.isEmpty) return const Constant(true);
  final result = iterable.reduce((value, element) => value & element);

  return result.equals(true);
}