validateAlphanumeric function

Future<bool> validateAlphanumeric(
  1. String str
)

Validates if a given string is alphanumeric.

Returns true if the string is alphanumeric, otherwise false.

Implementation

Future<bool> validateAlphanumeric(String str) async {
  RegExp alphanumericRegex = RegExp(r'^[a-zA-Z0-9]+$');
  return alphanumericRegex.hasMatch(str);
}