isValidUsername static method

bool isValidUsername(
  1. String? username, {
  2. bool withDot = true,
  3. RegExp? pattern,
})

Implementation

static bool isValidUsername(
  String? username, {
  bool withDot = true,
  RegExp? pattern,
}) {
  if (username != null && username.isNotEmpty) {
    if (withDot) {
      return (pattern ?? AuthPatterns.usernameWithDot).hasMatch(username);
    } else {
      return (pattern ?? AuthPatterns.username).hasMatch(username);
    }
  } else {
    return false;
  }
}