endsWithRtl static method
Determines if the exit directionality (ie, the last strongly-directional
character in text is RTL. If isHtml is true, the text is HTML or
HTML-escaped.
Implementation
static bool endsWithRtl(String text, [bool isHtml = false]) {
return RegExp(
'[$_RTL_CHARS][^$_LTR_CHARS]*\$',
).hasMatch(isHtml ? stripHtmlIfNeeded(text) : text);
}