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, () {
    final tree = resolveNode(root.render());
    _currentTree = tree;
    _componentTrees[root] = tree;
    _morphicOwners[tree] = root;

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

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