validatedName static method
Returns name
if it meets requirements for the specified reserveName
,
otherwise throws an Exception.
This same function is reusable for other reference names like Modules, not only Logics.
Implementation
static String? validatedName(String? name, {required bool reserveName}) {
if (reserveName) {
if (name == null) {
throw NullReservedNameException();
} else if (name.isEmpty) {
throw EmptyReservedNameException();
} else if (!Sanitizer.isSanitary(name)) {
throw InvalidReservedNameException();
}
}
return name;
}