usernameValidator static method

bool usernameValidator(
  1. String username
)

Implementation

static bool usernameValidator(String username) {
  if (username != "" &&
      username.contains(
          r"^(?=.{8,20}$)(?![_.])(?!.*[_.]{2})[a-zA-Z0-9._]+(?<![_.])$")) {
    return true;
  }
  return false;
}