GlobalMaterialLocalizations constructor Null safety
- {required String localeName,
- required DateFormat fullYearFormat,
- required DateFormat compactDateFormat,
- required DateFormat shortDateFormat,
- required DateFormat mediumDateFormat,
- required DateFormat longDateFormat,
- required DateFormat yearMonthFormat,
- required DateFormat shortMonthDayFormat,
- required NumberFormat decimalFormat,
- required NumberFormat twoDigitZeroPaddedFormat}
Initializes an object that defines the material widgets' localized strings
for the given locale
.
The arguments are used for further runtime localization of data, specifically for selecting plurals, date and time formatting, and number formatting. They correspond to the following values:
- The string that would be returned by Intl.canonicalizedLocale for the locale.
- The DateFormat for formatYear.
- The DateFormat for formatShortDate.
- The DateFormat for formatMediumDate.
- The DateFormat for formatFullDate.
- The DateFormat for formatMonthYear.
- The DateFormat for formatShortMonthDay.
- The NumberFormat for formatDecimal (also used by formatHour and formatTimeOfDay when timeOfDayFormat doesn't use HourFormat.HH).
- The NumberFormat for formatHour and the hour part of formatTimeOfDay when timeOfDayFormat uses HourFormat.HH, and for formatMinute and the minute part of formatTimeOfDay.
The narrowWeekdays and firstDayOfWeekIndex properties use the values from the intl.DateFormat used by formatFullDate.
Implementation
const GlobalMaterialLocalizations({
required String localeName,
required intl.DateFormat fullYearFormat,
required intl.DateFormat compactDateFormat,
required intl.DateFormat shortDateFormat,
required intl.DateFormat mediumDateFormat,
required intl.DateFormat longDateFormat,
required intl.DateFormat yearMonthFormat,
required intl.DateFormat shortMonthDayFormat,
required intl.NumberFormat decimalFormat,
required intl.NumberFormat twoDigitZeroPaddedFormat,
}) : assert(localeName != null),
_localeName = localeName,
assert(fullYearFormat != null),
_fullYearFormat = fullYearFormat,
assert(compactDateFormat != null),
_compactDateFormat = compactDateFormat,
assert(shortDateFormat != null),
_shortDateFormat = shortDateFormat,
assert(mediumDateFormat != null),
_mediumDateFormat = mediumDateFormat,
assert(longDateFormat != null),
_longDateFormat = longDateFormat,
assert(yearMonthFormat != null),
_yearMonthFormat = yearMonthFormat,
assert(shortMonthDayFormat != null),
_shortMonthDayFormat = shortMonthDayFormat,
assert(decimalFormat != null),
_decimalFormat = decimalFormat,
assert(twoDigitZeroPaddedFormat != null),
_twoDigitZeroPaddedFormat = twoDigitZeroPaddedFormat;