TemplateEngine class

The TemplateEngine can:

Features

  • Template expressions that can contain (combinations of):
    • Data types
    • Constants
    • Variables
    • Operators
    • Functions e.g. functions to import:
      • Pure files (to be imported as is)
      • Template files (to be parsed and rendered)
      • XML files (to be used as a data source)
      • JSON files (to be used as a data source)
      • YAML files (to be used as a data source)
  • All of the above can be customized or you could add your own.

Constructors

TemplateEngine.new({List<DataType<Object>>? dataTypes, List<Constant>? constants, List<OperatorGroup>? operatorGroups, List<FunctionGroup>? functionGroups, List<Tag<Object>>? tags, String tagStart = '{{', String tagEnd = '}}'})

Properties

constants List<Constant>
final
dataTypes List<DataType<Object>>
final
functionGroups List<FunctionGroup>
final
hashCode int
The hash code for this object.
no setterinherited
operatorGroups List<OperatorGroup>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tagEnd String
The tag ends with given suffix. Use a suffix combination that is not used elsewhere in your templates. e.g.: Do not use > as a suffix if your template contains HTML or XML By default the prefix is: }} Examples of other prefixes and suffixes:
getter/setter pair
tags List<Tag<Object>>
If null it will use StandardTagParsers
final
tagStart String
The tag starts with given prefix. Use a prefix combination that is not used elsewhere in your templates. e.g.: Do not use < as a prefix if your template contains HTML or XML By default the prefix is: {{ Examples of other prefixes and suffixes:
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parseTemplate(Template template) Future<ParseResult>
Parse the Template text into a parser tree. See Renderer
parseTemplates(List<Template> templates) Future<ParseResult>
Parse text from Templates into a parser tree. See Renderer
parseText(String text) Future<ParseResult>
render(ParseResult parseResults, [VariableMap? variables]) Future<RenderResult>
Render the parser tree to a string (and write it as files when needed)
toString() String
A string representation of this object.
inherited
validateNamesAreUnique() → void

Operators

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