LastName constructor
LastName(
- String? str
Returns a valid LastName object.
Throws ValueException:
- RequiredValueException if
str
is null or empty. - InvalidValueException if
str
is not a valid last name.
Implementation
factory LastName(String? str) {
if (str == null || str.isEmpty) {
throw const RequiredValueException();
} else if (!validate(str)) {
throw InvalidValueException(str);
}
return LastName._(str);
}