render method
Renders a template with the provided data.
templateName: Template path using dot notation (e.g., 'users.profile')data: Optional data map to make available in the template
Returns the rendered HTML as a string.
Example:
final html = engine.render('users.profile', {
'user': user,
'title': 'Profile Page',
'items': itemsList,
});
Throws TemplateEngineException.templateNotFound if template is not found.
Implementation
String render(String templateName, [Map<String, dynamic>? data]) {
final templateContent = _loadTemplate(templateName);
return _compile(templateContent, data ?? {});
}