MustacheTemplates class final
A TemplateEngine over mustache_template.
Templates are parsed once and reused, and partials resolve against the same set, so a layout including a header costs one parse each.
final templates = MustacheTemplates.fromDirectory('web/templates');
final app = Router()..withState(templates);
- Implemented types
Constructors
-
MustacheTemplates(Map<
String, String> sources) -
Compiles every entry of
sources, keyed by template name. - MustacheTemplates.fromDirectory(String directory, {String extension = '.html'})
-
Loads every file under
directorywhose name ends withextension.factory
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
render(
String name, Map< String, Object?> values) → String -
Renders the template called
namewithvalues.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited