compare method

  1. @override
int? compare(
  1. dynamic a,
  2. dynamic b
)
override

Comparison operator for sorting.

Compares a and b and returns a positive value if a is greater, 0 if a and b are equal, or negative if a is less.

Returns Null if comparison is not possible due to type difference, etc.

ソートを行うための比較演算子。

abを比較し、aが大きい場合は正の値、abが等しい場合は0、aが小さい場合は負の値を返します。

型が違う等で比較不可能の場合はNullを返します。

Implementation

@override
int? compare(dynamic a, dynamic b) {
  return _hasMatch(a, b, (a, b) => a.toString().compareTo(b.toString()));
}