toCamelCase static method

String toCamelCase(
  1. String input
)

Converts a_variable_name to aVariableName

Implementation

static String toCamelCase(String input) {
  final contents = input.toLowerCase();
  final snake = RegExp('(.*?)_([a-zA-Z])');
  final kebab = RegExp('(.*?)-([a-zA-Z])');

  return contents
      .replaceAllMapped(snake, _camelizeCallback)
      .replaceAllMapped(kebab, _camelizeCallback);
}