projectNameError function

String? projectNameError(
  1. String name,
  2. Iterable<String> others
)

Null when name is a valid project name: not empty and not among others (the names of the other projects); else why not.

Implementation

String? projectNameError(String name, Iterable<String> others) {
  if (name.trim().isEmpty) return 'the name is empty';
  if (others.contains(name)) {
    return '`$name` is the name of more than one project';
  }
  return null;
}