generateAnchorHash static method

String generateAnchorHash(
  1. Element element
)

Generates a valid HTML anchor from the inner text of element.

Implementation

static String generateAnchorHash(Element element) =>
    element.children!.first.textContent
        .toLowerCase()
        .trim()
        .replaceAll(RegExp('[^a-z0-9 _-]'), '')
        .replaceAll(RegExp(r'\s'), '-');