compare method
Compares two data maps based on this sort order
Implementation
int compare(Map<String, dynamic> a, Map<String, dynamic> b) {
final aValue = _getNestedValue(a, field);
final bValue = _getNestedValue(b, field);
// Handle null values (nulls last)
if (aValue == null && bValue == null) return 0;
if (aValue == null) return 1;
if (bValue == null) return -1;
final result = _compareValues(aValue, bValue);
return descending ? -result : result;
}