meanings method

List<NotationDefinition> meanings(
  1. String word
)

The meanings of word a use may be read with: all of a defined word's, or the named ones a component's word has (empty: none).

Implementation

List<NotationDefinition> meanings(String word) {
  if (has(word)) return _of(word) ?? const [];
  if (component?.call(word) == null) return const [];
  // The page's own named meanings of the component's word, else the
  // design system's (a page's unnamed one replaces the component: [has]).
  final named = [for (final d in page[word] ?? const <NotationDefinition>[]) if (d.name != null) d];
  return named.isNotEmpty ? named : [for (final d in definitions[word] ?? const <NotationDefinition>[]) if (d.name != null) d];
}