TemplateEngine class base

Parses and renders Archery HTML templates.

Templates are loaded from viewsDirectory by converting dot-delimited names to paths and appending .html. For example, users.profile resolves to users/profile.html. Parsed syntax trees are cached when shouldCache is true.

Constructors

TemplateEngine({required String viewsDirectory, required String publicDirectory})
Creates a template engine using the given view and public directories.

Properties

hashCode int
The hash code for this object.
no setterinherited
publicDirectory String
Directory containing publicly served assets.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shouldCache bool
Whether parsed file templates are retained between render calls.
getter/setter pair
viewsDirectory String
Directory containing template files.
final

Methods

clearCache() → void
Removes all parsed templates from the in-memory AST cache.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
render(String templateName, [Map<String, dynamic>? data]) Future<String>
Loads and renders the template identified by templateName.
renderString(String source, [Map<String, dynamic>? data]) Future<String>
Parses and renders template source without using the AST cache.
toString() String
A string representation of this object.
inherited

Operators

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