isValidName property

bool get isValidName

Accepts Unicode letters, spaces, hyphens, apostrophes, periods. Single names (mononyms) are valid. Max 100 chars guards against abuse.

Implementation

bool get isValidName {
  final s = trim();
  if (s.isEmpty || s.length > 100) return false;
  final re = RegExp(r"^[\p{L}\p{M}' .\-]+$", unicode: true);
  final hasLetter = RegExp(r'\p{L}', unicode: true).hasMatch(s);
  return hasLetter && re.hasMatch(s);
}