copyWith method Null safety

Node<T> copyWith(
  1. {String? key,
  2. String? label,
  3. List<Node>? children,
  4. bool? expanded,
  5. bool? parent,
  6. IconData? icon,
  7. Color? iconColor,
  8. Color? selectedIconColor,
  9. T? data}
)

Creates a copy of this object but with the given fields replaced with the new values.

Implementation

Node<T> copyWith({
  String? key,
  String? label,
  List<Node>? children,
  bool? expanded,
  bool? parent,
  IconData? icon,
  Color? iconColor,
  Color? selectedIconColor,
  T? data,
}) =>
    Node<T>(
      key: key ?? this.key,
      label: label ?? this.label,
      icon: icon ?? this.icon,
      iconColor: iconColor ?? this.iconColor,
      selectedIconColor: selectedIconColor ?? this.selectedIconColor,
      expanded: expanded ?? this.expanded,
      parent: parent ?? this.parent,
      children: children ?? this.children,
      data: data ?? this.data,
    );