$if static method

Tag $if(
  1. String condition, {
  2. List<Tag> then = const [],
  3. List<Tag> otherwise = const [],
})

Implementation

static Tag $if(
  String condition, {
  List<Tag> then = const [],
  List<Tag> otherwise = const [],
}) {
  return $JinjaBody(
    commandUp: 'if $condition',
    children: [
      ...then,
      if (otherwise.isNotEmpty) ...[
        $Jinja('else'),
        ...otherwise,
      ]
    ],
    commandDown: 'endif',
  );
}