toSnakeCase method

String toSnakeCase()

Converts this string to snake_case.

'helloWorld'.toSnakeCase();        // "hello_world"
'Hello World'.toSnakeCase();       // "hello_world"
'hello-world'.toSnakeCase();       // "hello_world"

Implementation

String toSnakeCase() => _splitWords().map((w) => w.toLowerCase()).join('_');