DisplayNames constructor
DisplayNames({
- Locale? locale,
- Style style = Style.long,
- LanguageDisplay languageDisplay = LanguageDisplay.dialect,
- Fallback fallback = Fallback.code,
Creates a new display name formatter configured for a specific locale.
locale: The locale whose language is used to format the names. Ifnull, the system's current locale is used.style: The desired length of the name, e.g., Style.long ('United States') or Style.short ('US'). Defaults to Style.long.languageDisplay: Controls how language names are displayed, e.g., including the dialect or region. Defaults to LanguageDisplay.dialect.fallback: Specifies the behavior if a display name is not available for a code. Defaults to Fallback.code, which returns the input code itself.
Implementation
DisplayNames({
Locale? locale,
Style style = Style.long,
LanguageDisplay languageDisplay = LanguageDisplay.dialect,
Fallback fallback = Fallback.code,
}) : _impl = DisplayNamesImpl.build(
locale ?? findSystemLocale(),
DisplayNamesOptions(
style: style,
languageDisplay: languageDisplay,
fallback: fallback,
),
);