Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit a63e19b

Browse files
authored
Remove unnecessary null checks in flutter_localizations (#118863)
1 parent 6cd4945 commit a63e19b

File tree

2 files changed

+2
-23
lines changed

2 files changed

+2
-23
lines changed

packages/flutter_localizations/lib/src/cupertino_localizations.dart

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,14 @@ abstract class GlobalCupertinoLocalizations implements CupertinoLocalizations {
6363
required intl.DateFormat doubleDigitMinuteFormat,
6464
required intl.DateFormat singleDigitSecondFormat,
6565
required intl.NumberFormat decimalFormat,
66-
}) : assert(localeName != null),
67-
_localeName = localeName,
68-
assert(fullYearFormat != null),
66+
}) : _localeName = localeName,
6967
_fullYearFormat = fullYearFormat,
70-
assert(dayFormat != null),
7168
_dayFormat = dayFormat,
72-
assert(mediumDateFormat != null),
7369
_mediumDateFormat = mediumDateFormat,
74-
assert(singleDigitHourFormat != null),
7570
_singleDigitHourFormat = singleDigitHourFormat,
76-
assert(singleDigitMinuteFormat != null),
7771
_singleDigitMinuteFormat = singleDigitMinuteFormat,
78-
assert(doubleDigitMinuteFormat != null),
7972
_doubleDigitMinuteFormat = doubleDigitMinuteFormat,
80-
assert(singleDigitSecondFormat != null),
8173
_singleDigitSecondFormat = singleDigitSecondFormat,
82-
assert(decimalFormat != null),
8374
_decimalFormat =decimalFormat;
8475

8576
final String _localeName;

packages/flutter_localizations/lib/src/material_localizations.dart

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,25 +97,15 @@ abstract class GlobalMaterialLocalizations implements MaterialLocalizations {
9797
required intl.DateFormat shortMonthDayFormat,
9898
required intl.NumberFormat decimalFormat,
9999
required intl.NumberFormat twoDigitZeroPaddedFormat,
100-
}) : assert(localeName != null),
101-
_localeName = localeName,
102-
assert(fullYearFormat != null),
100+
}) : _localeName = localeName,
103101
_fullYearFormat = fullYearFormat,
104-
assert(compactDateFormat != null),
105102
_compactDateFormat = compactDateFormat,
106-
assert(shortDateFormat != null),
107103
_shortDateFormat = shortDateFormat,
108-
assert(mediumDateFormat != null),
109104
_mediumDateFormat = mediumDateFormat,
110-
assert(longDateFormat != null),
111105
_longDateFormat = longDateFormat,
112-
assert(yearMonthFormat != null),
113106
_yearMonthFormat = yearMonthFormat,
114-
assert(shortMonthDayFormat != null),
115107
_shortMonthDayFormat = shortMonthDayFormat,
116-
assert(decimalFormat != null),
117108
_decimalFormat = decimalFormat,
118-
assert(twoDigitZeroPaddedFormat != null),
119109
_twoDigitZeroPaddedFormat = twoDigitZeroPaddedFormat;
120110

121111
final String _localeName;
@@ -298,7 +288,6 @@ abstract class GlobalMaterialLocalizations implements MaterialLocalizations {
298288
String pageRowsInfoTitle(int firstRow, int lastRow, int rowCount, bool rowCountIsApproximate) {
299289
String? text = rowCountIsApproximate ? pageRowsInfoTitleApproximateRaw : null;
300290
text ??= pageRowsInfoTitleRaw;
301-
assert(text != null, 'A $_localeName localization was not found for pageRowsInfoTitle or pageRowsInfoTitleApproximate');
302291
return text
303292
.replaceFirst(r'$firstRow', formatDecimal(firstRow))
304293
.replaceFirst(r'$lastRow', formatDecimal(lastRow))
@@ -446,7 +435,6 @@ abstract class GlobalMaterialLocalizations implements MaterialLocalizations {
446435
/// the short time pattern used in the `en_US` locale.
447436
@override
448437
TimeOfDayFormat timeOfDayFormat({ bool alwaysUse24HourFormat = false }) {
449-
assert(alwaysUse24HourFormat != null);
450438
if (alwaysUse24HourFormat) {
451439
return _get24HourVersionOf(timeOfDayFormatRaw);
452440
}

0 commit comments

Comments
 (0)