projectIdError function

String? projectIdError(
  1. String id
)

Null when id is a valid project id (projectIdPattern), else why not.

Implementation

String? projectIdError(String id) {
  if (projectIdPattern.hasMatch(id)) return null;
  if (id.isEmpty) return 'the id is empty';
  if (id.length < 2 || id.length > 8) {
    return '`$id` has ${id.length} characters; an id has 2 to 8';
  }
  if (!RegExp(r'^[A-Za-z]').hasMatch(id)) {
    return '`$id` does not start with a letter';
  }
  if (id != id.toUpperCase()) {
    return '`$id` is not upper-case (A-Z and 0-9 only)';
  }
  return '`$id` holds characters other than A-Z and 0-9';
}