Skip to content
pubscout

template_engine

2.0.3, released 10 days ago by an unverified publisher

Dart library to parse and render text templates with variables and custom tags.

$ flutter pub add template_engine
Source repository

What it does

TemplateEngine parses template text into a parse tree and renders it to various outputs such as HTML, Markdown, JSON, YAML, XML, or custom code. It supports statements, expressions, loops, conditionals, and custom grammar extensions.

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

Use it when

  • Generating static HTML or Markdown from templates
  • Producing configuration files (JSON/YAML) from templates
  • Creating code snippets or scripts via templating
  • Automating report generation with variable data

Skip it when

  • Building UI widgets that require reactive updates
  • Replacing a full templating engine with a simple string interpolation
  • Using it for large-scale data processing where performance is critical

Strengths

  • Highly customizable grammar and tags
  • Supports multiple output formats out of the box
  • No external code generation required
  • Simple API for parsing and rendering

Weaknesses

  • Not designed for UI rendering
  • No built-in caching or performance optimizations
  • Limited documentation beyond the README

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
7
import 'package:template_engine/template_engine.dart';

final engine = TemplateEngine();
final parseResult = await engine.parseText('Hello {{name}}.');
final renderResult = await engine.render(parseResult, variables: {'name': 'world'});
print(renderResult.text);

Alternatives

Packages that do the same job and could replace template_engine.

  • liquify

    A powerful and extensible Liquid template engine for Dart.

  • jinja

    Jinja2 template engine port for Dart supporting variables, control structures, and template inheritance.

  • baseflow_plugin_template

    A template for plugin examples

  • barbecue

    Render text tables for CLI-based Dart applications with custom borders, padding, and ANSI colors.

Works with

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