toOne function

int toOne(
  1. Object? object
)

Returns 1 if non null, 0 if null. Typically used for counting non-nulls. E.g., assert(toOne(a) + toOne(b) == 1)

Implementation

int toOne(Object? object) {
  return object == null ? 0 : 1;
}