cambelToUnderscore method

String cambelToUnderscore([
  1. String name = ''
])

Implementation

String cambelToUnderscore([String name = '']) {
  var response = '';
  for (var index = 0; index < name.length; index++) {
    var char = name[index];
    if (isUpper(char)) {
      response = response + (index == 0 ? '' : '_') + char.toLowerCase();
    } else {
      response = response + char;
    }
  }
  return response;
}