toValueList method

List<V> toValueList({
  1. bool sort = false,
  2. int compare(
    1. V a,
    2. V b
    )?,
})

Returns a List of the map values.

If sort is true, then the list will be sorted with compare, if provided, or with compareObject if not provided. If sort is false, compare will be ignored.

Implementation

List<V> toValueList({
  bool sort = false,
  int Function(V a, V b)? compare,
}) {
  assert(compare == null || sort == true);

  var result = List.of(values);
  if (sort) result.sort(compare ?? compareObject);
  return result;
}