validateName method
Validates the given container name to ensure it meets requirements.
This method checks that the container name is not empty, not only whitespace, and doesn't contain the delimiter character. It's called automatically during container construction but can also be used for explicit validation.
Parameters:
name- The container name to validate.
Throws:
- ArgumentError with message "Container name cannot be empty" if the name is an empty string
- ArgumentError with message "Container name cannot be only whitespace" if the name contains only whitespace characters
- ArgumentError with a descriptive message if the name contains the delimiter character
Implementation
@protected
@visibleForTesting
void validateName(String name) {
if (name.isEmpty) throw ArgumentError('Container name cannot be empty');
if (name.trim().isEmpty) throw ArgumentError('Container name cannot be only whitespace');
if (name.contains(delimiter)) {
throw ArgumentError('Container name cannot contain delimiter "$delimiter": $name');
}
}