toKebabCase method

String toKebabCase()

Converts the string to kebab-case (e.g., "Hello World" -> "hello-world").

Replaces spaces and special characters with hyphens and converts to lowercase.

Example:

"Hello World".toKebabCase(); // Returns "hello-world"
"camelCaseText".toKebabCase(); // Returns "camel-case-text"

Implementation

String toKebabCase() => toSnakeCase().replaceAll('_', '-');