isAlphaNumericOnly static method

bool isAlphaNumericOnly(
  1. String? text
)

验证是否只包含字母和数字

Implementation

static bool isAlphaNumericOnly(String? text) {
  if (text?.isEmpty ?? true) return false;
  final regex = RegExp(r'^[A-Za-z0-9]+$');
  return regex.hasMatch(text!);
}