EnumType constructor

EnumType(
  1. Iterable<String> categories
)

Creates an enum type from unique categories.

Throws an ArgumentError when categories repeat.

Implementation

EnumType(Iterable<String> categories)
  : categories = List.unmodifiable(categories) {
  if (this.categories.toSet().length != this.categories.length) {
    throw ArgumentError.value(categories, 'categories', 'must be unique');
  }
}