compare method

int compare(
  1. String? other
)

比较两个字符串是否相同,返回 -1/0/1。

Implementation

int compare(String? other) {
  final s = this;
  if (s == null || other == null) {
    return s == null ? -1 : 1;
  }
  if (s == other) {
    return 0;
  }
  return s.compareTo(other);
}