IntlScriptRecognizer class final

Recognize the correct language on intl package when Locale object offered Locale.languageCode and Locale.scriptCode only.

For example, if applying Traditional Chinese (zh_Hant) into intl package (e.g. DateFormat), it takes the fallback result (zh) which is Simplified Chinese. As a result, the formatted String becomes 2023年5月10日 周三 instead of 2023年5月10日 週三 which is simplified character of and both refer to day of week.

By default, it mapped Traditional Chinese (zh_Hant) to intl's recognizable locale String : zh_TW already.

Available Extensions


Return current instance of IntlScriptRecognizer. If no instance created yet, it will construct a new instance first.
IntlScriptRecognizer.delicated({Set<String> customRegion})
Construct a delicated IntlScriptRecognizer that it no longer memorize instance and return current instance by calling


hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited


applyCustomRegion(Set<String>? customRegion) → void
Define custom country code which may not recognized as country code yet or using as testing purpose.
assign(Map<Locale, String> applyContent, {bool replaceExisted = false}) → void
Assign the Map of applyContent which contains Locale with script code only as a key and a String of country code as value.
isAssigned(Locale locale) bool
Determine the given locale is assign already.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
resolve(Locale? locale) String?
Resolving intl recognizable String by the given locale.
resolveFromContext(BuildContext context) String?
Perform resolve from Localizations.maybeLocaleOf.
toString() String
A string representation of this object.
unassign(Locale locale) → void
Remove the assign data of locale.


operator ==(Object other) bool
The equality operator.

Static Methods

factoryReset() → void
A last resort Function that construct a new instance and replace the current one which remains default setting only.