range property

TextRange range

Get the range for this result for cloze purposes.

Implementation

TextRange get range {
  if (wordIndices.isEmpty) {
    return TextRange.empty;
  } else {
    int length = wordList[wordIndices.first].length;
    String beforeFirst = wordList.sublist(0, wordIndices.first).join();

    return TextRange(
      start: beforeFirst.length,
      end: beforeFirst.length + length,
    );
  }
}