asNameMap method Null safety
Creates a map from the names of enum values to the values.
The collection that this method is called on is expected to have
enums with distinct names, like the values
list of an enum class.
Only one value for each name can occur in the created map,
so if two or more enum values have the same name (either being the
same value, or being values of different enum type), at most one of
them will be represented in the returned map.
Implementation
Map<String, T> asNameMap() =>
<String, T>{for (var value in this) value._name: value};