BidiHelper class

A utility class that provides methods for detecting and estimating text directionality.

This class contains methods to analyze text content and determine whether it should be displayed in right-to-left (RTL) or left-to-right (LTR) direction based on the characters it contains.

Constructors

BidiHelper.new()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

detectRtlDirectionality(String str, {bool isHtml = false}) bool
Check the estimated directionality of str, return true if the piece of text should be laid out in RTL direction. If isHtml is true, the string is HTML or HTML-escaped.
estimateDirectionOfText(String text, {bool isHtml = false}) TextDirection?
Estimates the directionality of text using the best known general-purpose method (using relative word counts). A null return value indicates completely neutral input. isHtml is true if text HTML or HTML-escaped.
hasAnyLtr(String text, [bool isHtml = false]) bool
Determines if the given text has any LTR characters in it. If isHtml is true, the text is HTML or HTML-escaped.
startsWithRtl(String text, [bool isHtml = false]) bool
Determines if the first character in text with strong directionality is RTL. If isHtml is true, the text is HTML or HTML-escaped.
stripHtmlIfNeeded(String text) String
Returns the input text with spaces instead of HTML tags or HTML escapes, which is helpful for text directionality estimation.