adjustOrder method

Map<K, V> adjustOrder(
  1. int from,
  2. int to
)

Returns a new map with map order adjusted

Implementation

Map<K, V> adjustOrder(int from, int to) {
  int to0 = to;
  if (to0 > from) {
    to0 -= 1;
  }

  final entries = this.entries.toList();
  final item = entries.removeAt(from);
  entries.insert(to0, item);
  final Map<K, V> updated = Map.fromEntries(entries);
  return updated;
}