utils library

Functions

buildEmphasizedTextWidgets({required String text, required Iterable<WordMarker> markers, required TextStyle textStyle, required TextStyle wordStyle}) List<TextSpan>
Returns a list of widgets representing texts parts, each with its own style. Text enclosed by start and end markers, gets the given wordStyle. Text not enclosed by markers, gets the given textStyle.
getBlockMarkers(List<WordMarker> rawMarkers) List<WordMarker>
Revises the given rawMarkers, merges overlapping or embedded words to one big "block" and returns a list of WordMarkers which represents such "clean" word blocks.
Sorts the given rawMarkers by their index from lowest to highest.
getMarkedText({required String text, required Iterable<WordMarker> markers, String tags = '[]'}) String
Adds tags to the given text to mark words/blocks enclosed by the given markers. The tags must be exactly 2 characters - one opening and one closing tag.
getRawMarkers({required String text, required Iterable<String> words, bool caseSensitive = false}) List<WordMarker>
Gets the WordMarkers representing the start and end of all given words in the given text. This may include overlapping and embedded words.
sortByIndex(WordMarker a, WordMarker b) int
Used to sorts WordMarkers by their index, ascending.
If indexes are identical and marker types are different, the start marker comes first and the end marker comes second, making the resp. blocks intersect/overlap at that position.