resolvedTextDirection method

TextDirection? resolvedTextDirection()

Returns a text direction based on the CustomTextDirection setting. If it is based on locale and the locale cannot be determined, returns null.

Implementation

TextDirection? resolvedTextDirection() {
  switch (customTextDirection) {
    case CustomTextDirection.localeBased:
      final language = locale?.languageCode?.toLowerCase();
      if (language == null) return null;
      return rtlLanguages.contains(language)
          ? TextDirection.rtl
          : TextDirection.ltr;
    case CustomTextDirection.rtl:
      return TextDirection.rtl;
    default:
      return TextDirection.ltr;
  }
}