mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Remove unnecessary null checks in flutter_localizations (#118863)
This commit is contained in:
parent
6cd4945540
commit
a63e19ba0f
@ -63,23 +63,14 @@ abstract class GlobalCupertinoLocalizations implements CupertinoLocalizations {
|
|||||||
required intl.DateFormat doubleDigitMinuteFormat,
|
required intl.DateFormat doubleDigitMinuteFormat,
|
||||||
required intl.DateFormat singleDigitSecondFormat,
|
required intl.DateFormat singleDigitSecondFormat,
|
||||||
required intl.NumberFormat decimalFormat,
|
required intl.NumberFormat decimalFormat,
|
||||||
}) : assert(localeName != null),
|
}) : _localeName = localeName,
|
||||||
_localeName = localeName,
|
|
||||||
assert(fullYearFormat != null),
|
|
||||||
_fullYearFormat = fullYearFormat,
|
_fullYearFormat = fullYearFormat,
|
||||||
assert(dayFormat != null),
|
|
||||||
_dayFormat = dayFormat,
|
_dayFormat = dayFormat,
|
||||||
assert(mediumDateFormat != null),
|
|
||||||
_mediumDateFormat = mediumDateFormat,
|
_mediumDateFormat = mediumDateFormat,
|
||||||
assert(singleDigitHourFormat != null),
|
|
||||||
_singleDigitHourFormat = singleDigitHourFormat,
|
_singleDigitHourFormat = singleDigitHourFormat,
|
||||||
assert(singleDigitMinuteFormat != null),
|
|
||||||
_singleDigitMinuteFormat = singleDigitMinuteFormat,
|
_singleDigitMinuteFormat = singleDigitMinuteFormat,
|
||||||
assert(doubleDigitMinuteFormat != null),
|
|
||||||
_doubleDigitMinuteFormat = doubleDigitMinuteFormat,
|
_doubleDigitMinuteFormat = doubleDigitMinuteFormat,
|
||||||
assert(singleDigitSecondFormat != null),
|
|
||||||
_singleDigitSecondFormat = singleDigitSecondFormat,
|
_singleDigitSecondFormat = singleDigitSecondFormat,
|
||||||
assert(decimalFormat != null),
|
|
||||||
_decimalFormat =decimalFormat;
|
_decimalFormat =decimalFormat;
|
||||||
|
|
||||||
final String _localeName;
|
final String _localeName;
|
||||||
|
@ -97,25 +97,15 @@ abstract class GlobalMaterialLocalizations implements MaterialLocalizations {
|
|||||||
required intl.DateFormat shortMonthDayFormat,
|
required intl.DateFormat shortMonthDayFormat,
|
||||||
required intl.NumberFormat decimalFormat,
|
required intl.NumberFormat decimalFormat,
|
||||||
required intl.NumberFormat twoDigitZeroPaddedFormat,
|
required intl.NumberFormat twoDigitZeroPaddedFormat,
|
||||||
}) : assert(localeName != null),
|
}) : _localeName = localeName,
|
||||||
_localeName = localeName,
|
|
||||||
assert(fullYearFormat != null),
|
|
||||||
_fullYearFormat = fullYearFormat,
|
_fullYearFormat = fullYearFormat,
|
||||||
assert(compactDateFormat != null),
|
|
||||||
_compactDateFormat = compactDateFormat,
|
_compactDateFormat = compactDateFormat,
|
||||||
assert(shortDateFormat != null),
|
|
||||||
_shortDateFormat = shortDateFormat,
|
_shortDateFormat = shortDateFormat,
|
||||||
assert(mediumDateFormat != null),
|
|
||||||
_mediumDateFormat = mediumDateFormat,
|
_mediumDateFormat = mediumDateFormat,
|
||||||
assert(longDateFormat != null),
|
|
||||||
_longDateFormat = longDateFormat,
|
_longDateFormat = longDateFormat,
|
||||||
assert(yearMonthFormat != null),
|
|
||||||
_yearMonthFormat = yearMonthFormat,
|
_yearMonthFormat = yearMonthFormat,
|
||||||
assert(shortMonthDayFormat != null),
|
|
||||||
_shortMonthDayFormat = shortMonthDayFormat,
|
_shortMonthDayFormat = shortMonthDayFormat,
|
||||||
assert(decimalFormat != null),
|
|
||||||
_decimalFormat = decimalFormat,
|
_decimalFormat = decimalFormat,
|
||||||
assert(twoDigitZeroPaddedFormat != null),
|
|
||||||
_twoDigitZeroPaddedFormat = twoDigitZeroPaddedFormat;
|
_twoDigitZeroPaddedFormat = twoDigitZeroPaddedFormat;
|
||||||
|
|
||||||
final String _localeName;
|
final String _localeName;
|
||||||
@ -298,7 +288,6 @@ abstract class GlobalMaterialLocalizations implements MaterialLocalizations {
|
|||||||
String pageRowsInfoTitle(int firstRow, int lastRow, int rowCount, bool rowCountIsApproximate) {
|
String pageRowsInfoTitle(int firstRow, int lastRow, int rowCount, bool rowCountIsApproximate) {
|
||||||
String? text = rowCountIsApproximate ? pageRowsInfoTitleApproximateRaw : null;
|
String? text = rowCountIsApproximate ? pageRowsInfoTitleApproximateRaw : null;
|
||||||
text ??= pageRowsInfoTitleRaw;
|
text ??= pageRowsInfoTitleRaw;
|
||||||
assert(text != null, 'A $_localeName localization was not found for pageRowsInfoTitle or pageRowsInfoTitleApproximate');
|
|
||||||
return text
|
return text
|
||||||
.replaceFirst(r'$firstRow', formatDecimal(firstRow))
|
.replaceFirst(r'$firstRow', formatDecimal(firstRow))
|
||||||
.replaceFirst(r'$lastRow', formatDecimal(lastRow))
|
.replaceFirst(r'$lastRow', formatDecimal(lastRow))
|
||||||
@ -446,7 +435,6 @@ abstract class GlobalMaterialLocalizations implements MaterialLocalizations {
|
|||||||
/// the short time pattern used in the `en_US` locale.
|
/// the short time pattern used in the `en_US` locale.
|
||||||
@override
|
@override
|
||||||
TimeOfDayFormat timeOfDayFormat({ bool alwaysUse24HourFormat = false }) {
|
TimeOfDayFormat timeOfDayFormat({ bool alwaysUse24HourFormat = false }) {
|
||||||
assert(alwaysUse24HourFormat != null);
|
|
||||||
if (alwaysUse24HourFormat) {
|
if (alwaysUse24HourFormat) {
|
||||||
return _get24HourVersionOf(timeOfDayFormatRaw);
|
return _get24HourVersionOf(timeOfDayFormatRaw);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user