Skip to content
pubscout

template_expressions

4.4.1, released 6 weeks ago by ilt.run

A Dart library to process string-based templates using expressions.

$ flutter pub add template_expressions
Source repository

What it does

It processes string-based templates using built-in or custom expressions. It supports various expression syntaxes such as hash, mustache, pipe, and standard Dart-like string interpolation, alongside many built-in context objects like Codex, Crypto, DateFormat, and FileSystem.

AI-written summary of version 4.4.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to parse and evaluate text templates with embedded Dart-like expressions.
  • You want support for multiple template syntaxes like mustache or hash blocks.

Skip it when

  • You are looking for full heavy-weight HTML templating engines with looping/conditional markup control flow.
  • You need compile-time code generation for your templates.

Strengths

  • Multiple syntax options (hash, mustache, pipe, standard).
  • Rich set of built-in context objects and helpers including crypto, date formatting, and file systems.

Weaknesses

  • Limited documentation on some advanced objects in the provided material.
  • Requires proper escaping for certain standard interpolation syntaxes.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
14

Add template_expressions to pubspec.yaml and run dart pub get.

final template = Template('##firstName.toUpperCase()##', syntax: [HashExpressionSyntax()]);
final result = template.apply({'firstName': 'John'});

Alternatives

Packages that do the same job and could replace template_expressions.

Works with

Packages commonly used together with template_expressions: ones it builds on, ones built on it, and its own family.