withName method

Node withName(
  1. String? name
)

Implementation

Node withName(String? name) {
  final normalized = normalizeLayerName(name);

  return switch (this) {
    final TextNode n => n.copyWith(name: normalized),
    final ImageNode n => n.copyWith(name: normalized),
    final PathNode n => n.copyWith(name: normalized),
    final IconNode n => n.copyWith(name: normalized),
    final GroupNode n => n.copyWith(name: normalized),
  };
}