BidiText class final

A text's bidirectional layout by UAX #9: its paragraphs, the embedding level of each character and, for a line of a paragraph, the runs it is drawn in.

Indices are UTF-16 code units of text, as elsewhere in the core; both units of a surrogate pair carry the same level.

A line with Hebrew in it, as it is drawn:

final bidi = BidiText('abc אבג def');
print(bidi.visual(0, bidi.text.length)); // abc גבא def
print(bidi.visualRuns(0, bidi.text.length).length); // 3

Constructors

BidiText(String text, {TextDirection? direction})
Splits text into paragraphs after each paragraph separator, CR LF counted as one (rule P1), and resolves their levels (rules P2 to I2). Each paragraph runs in direction or, when that is null, in the direction of its first strong character outside isolates, left to right when there is none (rules P2 and P3).
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
isLeftToRight → bool
Whether every level is 0: text is drawn as it is stored.
final
levels → Uint8List
The resolved embedding level of each code unit, before the line's own rule L1 (lineLevels). A character rule X9 removes (an embedding, override, PDF or boundary neutral) takes the level of the one before it, its paragraph's at the start.
final
paragraphs → List<BidiParagraph>
The paragraphs, in order, covering text; one for an empty text.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
text → String
The text laid out.
final

Methods

lineLevels(int start, int end) → Uint8List
The levels of the line [start, end), which lies in one paragraph, after rule L1: separators, and the whitespace and isolate formatting characters before them and at the end of the line, take the paragraph's level.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
paragraphAt(int index) → BidiParagraph
The paragraph index is in; the last one for the end of text.
toString() → String
A string representation of this object.
inherited
visual(int start, int end) → String
The line [start, end) of a paragraph as it is drawn from left to right: its visualRuns, each right-to-left one with its grapheme clusters reversed and its characters mirrored by bidiMirror.
visualRuns(int start, int end) → List<BidiRun>
The line [start, end) of a paragraph as runs of one level, in the order they are drawn from left to right (rule L2).

Operators

operator ==(Object other) → bool
The equality operator.
inherited