isInValues method
- Iterable<
D> values
An expression that is true if this
resolves to any of the values in
values
.
The values will be mapped using the converter applied to this column.
Unlike Expression.isIn, this method will also handle nullability with
semantics on might expect in Dart. If values
contains null
and this
column is nullable, isInValues evaluates to true
.
Implementation
Expression<bool> isInValues(Iterable<D> values) {
final mappedValues = values.map(_mapDartValue);
final result = isIn(mappedValues.whereNotNull());
final hasNulls = mappedValues.any((e) => e == null);
if (hasNulls) {
return result | this.isNull();
} else {
return result & this.isNotNull();
}
}