isIdentifier property
bool
isIdentifier
Return true
if the string contains only alphanumeric letters (a-z) , (0-9) and
underscores (_).
A valid identifier cannot start with a number, or contain any spaces.
Example :
print('This123'.isIdentifier); // true
print('This 123'.isIdentifier); // false
print('123This'.isIdentifier); // false
print('This@123'.isIdentifier); // false
print('This_123'.isIdentifier); // true
Implementation
bool get isIdentifier =>
RegExp(r'^[\p{L}\p{N}_]+$', unicode: true).hasMatch(this) &&
!first.isInteger;