byTerm method

Iterable<Token> byTerm(
  1. String term
)

Filters the collection for tokens with Token.term == term.

Orders the filtered Tokens by Token.termPosition in ascending order.

Implementation

Iterable<Token> byTerm(String term) {
  final tokens = where((element) => element.term == term).toList();
  tokens.sort((a, b) => a.termPosition.compareTo(b.termPosition));
  return tokens;
}