hasAnyRtl static method

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

Determines if the given text has any RTL characters in it. If isHtml is true, the text is HTML or HTML-escaped.

Implementation

static bool hasAnyRtl(String text, [isHtml = false]) {
  return RegExp(r'[' '$_RTL_CHARS' r']')
      .hasMatch(isHtml ? stripHtmlIfNeeded(text) : text);
}