copyWith<T> method Null safety

TreeViewController copyWith<T>(
  1. {List<Node<T>>? children,
  2. String? selectedKey}
)

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

Implementation

TreeViewController copyWith<T>({List<Node<T>>? children, String? selectedKey}) {
  return TreeViewController(
    children: children ?? this.children,
    selectedKey: selectedKey ?? this.selectedKey,
  );
}