legalDartIdentifier function
Replaces all characters in imput
that are not valid in a dart identifier
with _.
This function does not take care of leading underscores.
Implementation
String legalDartIdentifier(String imput) {
return imput.replaceAll(RegExp(r'[^a-zA-Z0-9$_]'), '_');
}