render method
Renders the given template into a SourceCode object.
The renderer processes template placeholders, conditionals, loops, and filters, producing a fully resolved output. Implementations may leverage caching, custom variable resolvers, and expression evaluators. All dynamic attributes from the template context are applied during rendering. This method returns a SourceCode object containing the rendered result.
The built parameter, is for any built asset that the user wants to render.
This skips future asset building when rendering is called.
Implementation
@override
SourceCode render(Template template, [Asset? built]) {
final cache = getCache().get(template.getLocation());
if (cache != null) {
return cache;
}
final renderer = getRenderer();
final resolver = getVariableResolver();
resolver.setVariables(template.getAttributes());
final result = renderer.render(template, DefaultTemplateContext(resolver, getExpressionEvaluator()), built);
getCache().put(template.getLocation(), result);
return result;
}