addHeading method

void addHeading(
  1. String text, {
  2. int level = 1,
})

Adds an HTML section heading element.

Implementation

void addHeading(String text, {int level = 1}) {
  const allowedTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];

  final tag = allowedTags.contains('h$level') ? 'h$level' : allowedTags.first;

  addRaw(_wrap(tag: tag, content: text), addEOL: true);
}