toSnakeCase method

String toSnakeCase()

Converts the string to snake_case.

Example:

'helloWorld'.toSnakeCase(); // 'hello_world'
'Hello World'.toSnakeCase(); // 'hello_world'

Implementation

String toSnakeCase() =>
    words().map((String word) => word.toLowerCase()).join('_');