nameToCategory property
A map of category name to the category itself.
Implementation
Map<String, Category> get nameToCategory {
if (_nameToCategory.isEmpty) {
Category categoryFor(String category) {
_nameToCategory.putIfAbsent(
category, () => Category(category, this, config));
return _nameToCategory[category];
}
_nameToCategory[null] = Category(null, this, config);
for (var c in libraries.expand(
(l) => l.allCanonicalModelElements.whereType<Categorization>())) {
if (c.hasCategoryNames) {
for (var category in c.categoryNames) {
categoryFor(category).addItem(c);
}
} else {
// Add to the default category.
categoryFor(null).addItem(c);
}
}
}
return _nameToCategory;
}