isUsername static method

bool isUsername(
  1. String username
)

validation username Min 6 and Max 18 characters Only support lowercase or uppercase or number character Only support special character ._

Implementation

static bool isUsername(String username) {
  return RegExp(r'^[a-zA-Z0-9._]{6,18}$').hasMatch(username);
}