generate method
T?
generate(
- DOMNode root, {
- DOMTreeMap<
T> ? treeMap, - T? parent,
- DOMContext<
T> ? context, - bool finalizeTree = true,
- bool setTreeMapRoot = true,
Generates an element T
using root
.
treeMap
Tree to populate. If null
calls createGenericDOMTreeMap to define DOMTreeMap instance.
context
Optional context for this generated tree.
parent
Optional parent to add the generated element.
finalizeTree
Default true
: calls finalizeGeneratedTree.
Implementation
T? generate(DOMNode root,
{DOMTreeMap<T>? treeMap,
T? parent,
DOMContext<T>? context,
bool finalizeTree = true,
bool setTreeMapRoot = true}) {
treeMap ??= createGenericDOMTreeMap();
context ??= _domContext;
if (setTreeMapRoot) {
treeMap.setRoot(root, null);
}
var rootElement = build(null, parent, root, treeMap, context);
if (setTreeMapRoot) {
treeMap.setRoot(root, rootElement);
}
_callFinalizeGeneratedTree(treeMap, context, finalizeTree);
return rootElement;
}