$JinjaBlock class

Represents a Jinja template block definition. $JinjaBlock creates named template blocks that can be extended or overridden in child templates. This is a fundamental feature of Jinja's template inheritance system, allowing for modular and reusable template structures. Example usage:

final contentBlock = $JinjaBlock(
  blockName: 'content',
  children: [
    CustomTag('h1').addChild(TextTag('Default Content')),
    CustomTag('p').addChild(TextTag('This can be overridden')),
  ],
);
// Generates: {% block content %}<h1>Default Content</h1><p>This can be overridden</p>{% endblock %}
Inheritance

Constructors

$JinjaBlock({required String blockName, List<Tag>? children})

Properties

attrs ↔ Map
getter/setter pairinherited
children ↔ List<Tag>
getter/setter pairinherited
classes ↔ List
getter/setter pairinherited
commandDown ↔ String
getter/setter pairinherited
commandUp ↔ String
getter/setter pairinherited
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tagName → String
no setterinherited
type ↔ TagType
getter/setter pairinherited

Methods

addAttr(String key, dynamic value) → Tag
inherited
addChild(Tag child) → Tag
inherited
addClass(dynamic className) → Tag
inherited
addStyle(String property, String value) → Tag
inherited
attrKey(dynamic key) → String
inherited
clearChildren() → Tag
inherited
clearClasses() → Tag
inherited
clearStyles() → Tag
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeAttr(String key) → Tag
inherited
removeChild(Tag child) → Tag
inherited
removeClass(String className) → Tag
inherited
removeStyle(String property) → Tag
inherited
setClass(String className) → Tag
inherited
setId(String id) → Tag
inherited
setStyle(String property, String value) → Tag
inherited
toHtml() → String
inherited
toString({bool pretty = false}) → String
A string representation of this object.
inherited

Operators

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