getWordIdx method

int getWordIdx(
  1. String word
)

Retrieves the index of a word within the list.

Throws a StateError if the word is not found in the list.

Implementation

int getWordIdx(String word) {
  final index = _idxToWords.indexOf(word);
  if (index < 0) {
    throw MessageException("Unable to find word $word");
  }
  return index;
}