legalDartIdentifier function

String legalDartIdentifier(
  1. String input
)

Replaces all characters in input that are not valid in a dart identifier with _.

This function does not take care of leading underscores.

Implementation

String legalDartIdentifier(String input) {
  return input.replaceAll(RegExp(r'[^a-zA-Z0-9$_]'), '_');
}