jinja
0.7.2, released 2 months ago by ykmnkmi.kz
Jinja2 template engine port for Dart supporting variables, control structures, and template inheritance.
What it does
Jinja provides a template engine for Dart that supports variables, expressions, control structures, and template inheritance. It lets you render templates from strings or files directly to strings or a StringSink.
AI-written summary of version 0.7.2, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to render text templates with variables and logic in Dart
- You want to use Jinja2-style template syntax in a Dart or Flutter project
Skip it when
- You need automated HTML auto-escaping out of the box
- You require full Python Jinja2 feature parity including *args and **kwargs
Strengths
- Familiar Jinja2 syntax and template inheritance
- Supports multiple loaders like FileSystemLoader and MapLoader
Weaknesses
- Some Python Jinja features and auto-escaping are removed
- String slices and negative indexes are not fully supported
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 5
Not documented
var environment = Environment();
var template = environment.fromString('Hello {{ name }}!');
print(template.render({'name': 'World'}));Alternatives
Packages that do the same job and could replace jinja.
- template_expressions
A Dart library to process string-based templates using expressions.
62Compare - baseflow_plugin_template
A template for plugin examples
53Compare - liquify
A powerful and extensible Liquid template engine for Dart.
72Compare - template_engine
Dart library to parse and render text templates with variables and custom tags.
64Compare
Works with
Packages commonly used together with jinja: ones it builds on, ones built on it, and its own family.
- string_scannerjinja depends on itA class for parsing strings using a sequence of patterns.
- html_unescapejinja depends on itUn-escapes HTML-encoded strings supporting named, decimal, and hexadecimal character references.
- textwrapjinja depends on itText wrapping and filling utility library, a pure port of Python's textwrap module.
- finchBuilt on jinjaA lightweight Dart framework for building server‑side web apps, APIs, databases and WebSockets.
- static_shockBuilt on jinjaA static site generator for Dart.