bindView function

void bindView(
  1. View view,
  2. ElementSchemaRegistry? schemaRegistry, {
  3. required bool bindHostProperties,
})

Visits view nodes to generate code for bindings.

Called by ViewCompiler for each top level CompileView and the ViewBinderVisitor recursively for each embedded template.

HostProperties are bound for Component and Host views, but not embedded views.

Implementation

void bindView(
  ir.View view,
  ElementSchemaRegistry? schemaRegistry, {
  required bool bindHostProperties,
}) {
  var visitor = _ViewBinderVisitor(view.compileView!);
  templateVisitAll(visitor, view.parsedTemplate, null);
  for (var pipe in view.compileView!.pipes) {
    bindPipeDestroyLifecycleCallbacks(pipe.meta, pipe.instance, pipe.view);
  }

  if (bindHostProperties) {
    _bindViewHostProperties(view.compileView!, schemaRegistry!);
  }
}