copyWithout method

Attributes copyWithout(
  1. String key
)

Creates a new Attributes instance with the specified attribute removed. If the key doesn't exist, returns this instance unchanged.

@param key The key of the attribute to remove @return A new Attributes instance with the attribute removed

Implementation

Attributes copyWithout(String key) {
  if (!_entries.containsKey(key)) return this; // Nothing to remove
  final newEntries = Map<String, Attribute>.from(_entries);
  newEntries.remove(key);
  return AttributesCreate.create(newEntries.values.toList());
}