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 directory whose name ends with extension.
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
names → List<String>
The names that can be rendered, sorted.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

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 name with values.
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited