compareAttributes method

int compareAttributes(
  1. E entity
)

Compares two entities based on their attributes. If the result is less than 0 then the first id is less than the second, if it is equal to 0 they are equal and if the result is greater than 0 then the first is greater than the second.

Implementation

int compareAttributes(E entity) {
  var compare = 0;
  for (Attribute a in concept.attributes.whereType<Attribute>()) {
    var value1 = _attributeMap[a.code!];
    var value2 = entity.getAttribute(a.code!);

    // todo: check if this works
    compare = a.type?.compare(value1, value2) ?? 0;
    if (compare != 0) {
      break;
    }
  } // for
  return compare;
}