NyLocaleHelper class
Helper class for locale-related operations.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
getCountryCode(
{BuildContext? context}) → String? - Get the country code of the current locale, if available.
-
getCurrentLocale(
{BuildContext? context}) → Locale - Get the current system locale. Uses the context if available, otherwise falls back to platform dispatcher.
-
getCurrentTextDirection(
{BuildContext? context}) → TextDirection - Get the text direction for the current locale.
-
getLanguageCode(
{BuildContext? context}) → String - Get the language code of the current locale.
-
getTextDirection(
String languageCode) → TextDirection - Get the text direction for a language code.
-
isCurrentLocaleRtl(
{BuildContext? context}) → bool - Check if the current locale uses right-to-left text direction.
-
isRtlLanguage(
String languageCode) → bool - Check if a language code uses right-to-left text direction.
-
matchesLocale(
BuildContext? context, String languageCode, [String? countryCode]) → bool - Check if the current locale matches a specific language (and optionally country).
-
toLocale(
String languageCode, [String? countryCode]) → Locale - Create a Locale from a language code and optional country code.
Constants
-
rtlLanguages
→ const List<
String> - Common RTL (right-to-left) language codes. Includes Arabic, Hebrew, Persian, Urdu, Yiddish, Pashto, Kurdish, Sindhi, and Divehi (Maldivian).