copyWith method

Attributes copyWith(
  1. List<Attribute<Object>> other
)

Creates a new Attributes instance by adding or updating multiple attributes.

@param other A list of attributes to add or update @return A new Attributes instance with the added/updated attributes If the input list is empty, returns this instance unchanged.

Implementation

Attributes copyWith(List<Attribute> other) {
  if (other.isEmpty) {
    return this;
  }
  final newEntries = {
    ..._entries,
  };
  for (var attr in other) {
    newEntries[attr.key] = attr;
  }
  return AttributesCreate.create(newEntries.values.toList());
}