isRtl method

bool isRtl(
  1. String text
)

Implementation

bool isRtl(String text) {
  // Regular expression to check for RTL characters (e.g., Arabic, Hebrew)
  final rtlPattern = RegExp(r'[\u0590-\u08FF\u200F\u202B\u202E\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF]');
  // If any character in the string matches the RTL pattern, return true
  return rtlPattern.hasMatch(text);
}