isHighlightedWord function

  1. @protected
bool isHighlightedWord(
  1. List<String> wordList, {
  2. required int index,
  3. required WordHighlight wordHighlight,
})

Implementation

@protected
bool isHighlightedWord(List<String> wordList,
    {required int index, required WordHighlight wordHighlight}) {
  switch (wordHighlight.highlightType) {
    case HighlightType.byIndex:
      {
        return index == wordHighlight.wordIndex;
      }
    case HighlightType.byWord:
      {
        return wordHighlight.ignoreCase
            ? wordList[index].toLowerCase() ==
            wordHighlight.word?.toLowerCase()
            : wordList[index] == wordHighlight.word;
      }
    default:
      false;
  }

  return false;
}