toSlug method

String toSlug()

URL-friendly slug (Persian letters kept). "Hello World!" → "hello-world"

Implementation

String toSlug() => trim().toLowerCase().replaceAll(RegExp(r"[^\w؀-ۿ]+"), "-").replaceAll(RegExp(r"^-+|-+$"), "");