TreeViewController constructor

TreeViewController({
  1. required TreeNode rootNode,
  2. bool useBinarySearch = false,
  3. void onAboutToExpand(
    1. TreeNode node
    )?,
})

Creates a TreeViewController.

The useBinarySearch parameter determines whether TreeViewControllerBase.indexOf should use flutter's binarySearch instead of List.indexOf when looking for the index of a node.

The binary search will compare the TreeNode.id of two nodes. If set to true, make sure that TreeNode.id is ASCII formatted otherwise this could lead to adding/removing the wrong nodes from the tree.

Implementation

TreeViewController({
  required TreeNode rootNode,
  bool useBinarySearch = false,
  this.onAboutToExpand,
})  : assert(rootNode.isRoot, "The rootNode's parent must be null."),
      super(
        rootNode: rootNode,
        useBinarySearch: useBinarySearch,
      );