bindAndWriteToRenderer function
void
bindAndWriteToRenderer(
- List<
Binding> bindings, - BoundValueConverter converter,
- Expression? appViewInstance,
- NodeReference? renderNode,
- bool isHtmlElement,
- ViewNameResolver nameResolver,
- ViewStorage storage,
- CompileMethod targetMethod, {
- bool isHostComponent = false,
- bool calcChanged = false,
For each binding, creates code to update the binding.
Example: final currVal_1 = this.context.someBoolValue; if (import6.checkBinding(this._expr_1,currVal_1)) { this.renderer.setElementClass(this._el_4,'disabled',currVal_1); this._expr_1 = currVal_1; }
Implementation
void bindAndWriteToRenderer(
List<ir.Binding> bindings,
BoundValueConverter converter,
o.Expression? appViewInstance,
NodeReference? renderNode,
bool isHtmlElement,
ViewNameResolver nameResolver,
ViewStorage storage,
CompileMethod targetMethod, {
bool isHostComponent = false,
bool calcChanged = false,
}) {
final dynamicMethod = CompileMethod();
final constantMethod = CompileMethod();
for (var binding in bindings) {
if (binding.isDirect) {
_directBinding(
binding,
converter,
binding.source.isImmutable ? constantMethod : dynamicMethod,
appViewInstance,
renderNode,
isHtmlElement,
);
continue;
}
_checkBinding(
binding,
converter,
nameResolver,
appViewInstance,
renderNode,
isHtmlElement,
calcChanged,
storage,
dynamicMethod,
constantMethod,
isHostComponent);
}
if (constantMethod.isNotEmpty) {
targetMethod.addStmtsIfFirstCheck(constantMethod.finish());
}
if (dynamicMethod.isNotEmpty) {
targetMethod.addStmts(dynamicMethod.finish());
}
}