camelCaseToSnakeCase function

String camelCaseToSnakeCase(
  1. String input
)

Method to convert camelCases to snake_cases

Implementation

String camelCaseToSnakeCase(String input) {
  return input.replaceAllMapped(RegExp('([A-Z])|([0-9]+)'),
      (match) => '_${match.group(0)!.toLowerCase()}');
}