renameKey method
New map with oldKey renamed to newKey; unchanged if oldKey absent.
Implementation
@useResult
Map<K, V> renameKey(K oldKey, K newKey) {
final Map<K, V> out = Map<K, V>.from(this);
if (out.containsKey(oldKey)) {
final v = out.remove(oldKey);
if (v != null) out[newKey] = v;
}
return out;
}