IncludeStatement class final
Represents an include statement in a template, which imports or embeds another template within the current template.
IncludeStatement implements Statement and CodeElement, providing information about the included template and the statement associated with it.
Responsibilities
- Store the name of the template to include (
templateName). - Store the statement or description related to the include.
- Provide opening tag representation for template rendering.
Design Notes
- Opening tag uses the syntax
'{{>templateName}}'. - Include statements do not have a closing tag.
- Children list is always empty because include statements are atomic.
- Useful in template engines that support modular templates or partials.
Usage Example
final include = IncludeStatement(
templateName: 'header',
statement: 'Include header template',
line: '{{>header}}',
);
print(include.getOpeningTag()); // '{{>header}}'
print(include.getClosingTag()); // null
print(include.getChildren().length); // 0
- Implemented types
Constructors
- IncludeStatement({required String templateName, required String statement, required String line})
-
Creates a new IncludeStatement with the given
templateName,statement, andline.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
equalizedProperties(
) → List< Object?> -
Mixin-style contract for value-based equality,
hashCode, andtoString. -
getChildren(
) → List< CodeElement> -
Returns the list of child elements contained within this element.
override
-
getClosingTag(
) → String? -
Returns the closing tag of this element, if applicable.
override
-
getContent(
) → String -
Returns the content of this element, excluding/including tags.
override
-
getLine(
) → String -
Returns the raw line of code corresponding to this element.
override
-
getOpeningTag(
) → String? -
Returns the opening tag of this element, if applicable.
override
-
getStatement(
) → String -
Returns the core statement content.
override
-
getTagName(
) → String? -
Returns the name of the tag or element, if applicable.
override
-
getTemplateName(
) → String - Returns the name of the included template.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited