mount method

void mount(
  1. Component root
)

Implementation

void mount(Component root) {
  if (_mounted) {
    throw StateError('ComponentRuntime is already mounted');
  }

  rootComponent = root;
  root.attach(this);

  RenderContext.run(this, () {
    // resolveNode registers each Component's tree as it recurses.
    // createDom registers each Component's DOM node as it recurses.
    final tree = resolveNode(root.render(), owner: root);
    _currentTree = tree;

    final dom = createDom(tree, componentOwner: root);
    _componentTrees[root] = tree;
    _componentNodes[root] = dom;

    renderer.mount(tree);
    _mounted = true;
  });
}