build method

TreeNode build([
  1. TreeBuildContext? buildContext
])

Builds a state tree, and returns the root node of the tree.

A buildContext may optionally provided. This is typically not needed, but may be useful in advanced scenarios requiring access to the state tree as it is built.

Implementation

TreeNode build([TreeBuildContext? buildContext]) {
  var buildContext_ =
      buildContext ?? _createBuildContext?.call() ?? TreeBuildContext();
  var rootNodeInfo = treeBuildInfoProvider.createRootNodeInfo();
  return buildContext_.buildTree(rootNodeInfo);
}