isUsername method

bool isUsername(
  1. String username
)

Validates if the given username meets the required criteria.

The username must be between 3 and 16 characters long and include only letters, numbers, underscores, and dots. Returns true if the username is valid, otherwise false.

Implementation

bool isUsername(String username) {
  bool usernameValid = RegExp(r'^[a-zA-Z0-9._]{3,16}$').hasMatch(username);
  return usernameValid;
}