endsWithLtr static method

bool endsWithLtr(
  1. String text, [
  2. bool isHtml = false
])

Determines if the exit directionality (ie, the last strongly-directional character in text is LTR. If isHtml is true, the text is HTML or HTML-escaped.

Implementation

static bool endsWithLtr(String text, [bool isHtml = false]) {
  return RegExp('[$_LTR_CHARS][^$_RTL_CHARS]*\$')
      .hasMatch(isHtml ? stripHtmlIfNeeded(text) : text);
}