userIdValidator static method
Implementation
static String? userIdValidator(String? value) {
final userId = (value ?? "").trim();
if (userId.isEmpty) {
return "Enter user ID";
}
if (userId.length > 64) {
return "Maximum 64 characters allowed";
}
if (!RegExp(r'^[a-zA-Z0-9@._+-]+$').hasMatch(userId)) {
return "Only letters, numbers, @ . _ + - are allowed";
}
return null;
}