startsWithLtr method Null safety

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

Determines if the first character in text with strong directionality is LTR. If isHtml is true, the text is HTML or HTML-escaped.

Implementation

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