equalsNullable method Null safety

Expression<bool> equalsNullable(
  1. D? compare
)

Compares the value of this column to compare or null.

When compare is null, this generates an IS NULL expression in SQL. For non-null values, an equals expression is generated. This means that, for this method, two null values are considered equal. This deviates from the usual notion in SQL that doesn't allow comparing NULL values with equals.

Implementation

Expression<bool> equalsNullable(D? compare) {
  if (compare == null) {
    return this.isNull();
  } else {
    return equals(compare);
  }
}