compareToIgnoreCase method

  1. @override
int compareToIgnoreCase(
  1. Object? other
)
override

Compares this string to other ignoring case.

Returns a negative value if this is ordered before other, a positive value if this is ordered after other, or zero if this and other are equivalent ignoring case.

other can be a String or a Stringer (null means empty string).

Implementation

@override
int compareToIgnoreCase(Object? other) {
  final mine = _str.toLowerCase();
  if (other == null) {
    return mine.compareTo('');
  }
  return mine.compareTo(other.toString().toLowerCase());
}