toKeyList method

List<K> toKeyList({
  1. int compare(
    1. K a,
    2. K b
    )?,
})

Returns a List of the map keys.

The list will be sorted if the map's sort configuration is true, or if you explicitly provide a compare method.

Implementation

List<K> toKeyList({int Function(K a, K b)? compare}) {
  var result = List.of(keys);
  if (compare != null || config.sort) result.sort(compare);
  return result;
}