slug static method
Formats a string as a slug
Example:
StringFormatters.slug('Hello World!'); // 'hello-world'
Implementation
static String slug(String text) {
return text
.toLowerCase()
.replaceAll(RegExp(r'[^\w\s-]'), '')
.replaceAll(RegExp(r'[-\s]+'), '-')
.trim();
}