createCopy method

DeepNavigationNode<T> createCopy({
  1. T? newValue,
  2. int? newLevel,
  3. DeepNavigationNode<T>? newChild,
})

Creates a deep copy of this DeepNavigationNode with any of the newValues if provided.

Note that unlike setChild, this will add the newChild as is.

Implementation

DeepNavigationNode<T> createCopy(
        {T? newValue, int? newLevel, DeepNavigationNode<T>? newChild}) =>
    DeepNavigationNode<T>(newValue ?? value,
        level: newLevel ?? level, child: newChild ?? child?.createCopy());