build method
Implementation
TreeNode build(TreeBuildContext context) {
_validate();
var rootBuilders = _stateBuilders.values.where((b) => b._stateType == _StateType.root).toList();
if (rootBuilders.isEmpty) {
throw StateError('No root builders available');
} else if (rootBuilders.length > 1) {
throw StateError('Found multiple root nodes.');
}
// If there is a single root, then we have a well formed state tree.
return rootBuilders.first._toNode(context, _stateBuilders);
}