isAlphaNumeric function
Checks if the provided character input is alphanumeric (A-Z, a-z, 0-9).
print(isAlphaNumeric('a')); // true
print(isAlphaNumeric('5')); // true
print(isAlphaNumeric('@')); // false
print(isAlphaNumeric('Hello123')); // true
print(isAlphaNumeric('Hello@123')); // false
Implementation
bool isAlphaNumeric(String input) {
if (input.length == 1) {
return isDigit(input) || isAlpha(input);
} else {
return input.split('').every((c) => isAlphaNumeric(c));
}
}