normalizeName function
normalizes name _variable => $variable __typename => $$typename new -> kw$new
Implementation
String normalizeName(String name) {
final regExp = RegExp(r'^(_+)([\w$]*)$');
var matches = regExp.allMatches(name);
if (matches.isNotEmpty) {
var match = matches.elementAt(0);
var fieldName = match.group(2)!;
return fieldName.padLeft(name.length, r'$');
}
if (dartKeywords.contains(name.toLowerCase())) {
return 'kw\$$name';
}
return name;
}