Skip to content

Commit 5e74afc

Browse files
Migrate to null aware elements - Part 2 (flutter#172306)
<!-- Thanks for filing a pull request! Reviewers are typically assigned within a week of filing a request. To learn more about code review, see our documentation on Tree Hygiene: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md --> Replace null checks with null aware elements - part 2 Part of flutter#172188 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
1 parent cdb0d03 commit 5e74afc

3 files changed

Lines changed: 20 additions & 20 deletions

File tree

packages/flutter_goldens/lib/flutter_goldens.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ abstract class FlutterGoldenFileComparator extends GoldenFileComparator {
234234
);
235235
return Uri.parse(
236236
<String>[
237-
if (namePrefix != null) namePrefix!,
237+
?namePrefix,
238238
basedir.pathSegments[basedir.pathSegments.length - 2],
239239
golden.toString(),
240240
].join('.'),

packages/flutter_localizations/lib/src/cupertino_localizations.dart

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -357,12 +357,12 @@ abstract class GlobalCupertinoLocalizations implements CupertinoLocalizations {
357357

358358
@override
359359
List<String> get timerPickerHourLabels => <String>[
360-
if (timerPickerHourLabelZero != null) timerPickerHourLabelZero!,
361-
if (timerPickerHourLabelOne != null) timerPickerHourLabelOne!,
362-
if (timerPickerHourLabelTwo != null) timerPickerHourLabelTwo!,
363-
if (timerPickerHourLabelFew != null) timerPickerHourLabelFew!,
364-
if (timerPickerHourLabelMany != null) timerPickerHourLabelMany!,
365-
if (timerPickerHourLabelOther != null) timerPickerHourLabelOther!,
360+
?timerPickerHourLabelZero,
361+
?timerPickerHourLabelOne,
362+
?timerPickerHourLabelTwo,
363+
?timerPickerHourLabelFew,
364+
?timerPickerHourLabelMany,
365+
?timerPickerHourLabelOther,
366366
];
367367

368368
/// Subclasses should provide the optional zero pluralization of [timerPickerMinuteLabel] based on the ARB file.
@@ -405,12 +405,12 @@ abstract class GlobalCupertinoLocalizations implements CupertinoLocalizations {
405405

406406
@override
407407
List<String> get timerPickerMinuteLabels => <String>[
408-
if (timerPickerMinuteLabelZero != null) timerPickerMinuteLabelZero!,
409-
if (timerPickerMinuteLabelOne != null) timerPickerMinuteLabelOne!,
410-
if (timerPickerMinuteLabelTwo != null) timerPickerMinuteLabelTwo!,
411-
if (timerPickerMinuteLabelFew != null) timerPickerMinuteLabelFew!,
412-
if (timerPickerMinuteLabelMany != null) timerPickerMinuteLabelMany!,
413-
if (timerPickerMinuteLabelOther != null) timerPickerMinuteLabelOther!,
408+
?timerPickerMinuteLabelZero,
409+
?timerPickerMinuteLabelOne,
410+
?timerPickerMinuteLabelTwo,
411+
?timerPickerMinuteLabelFew,
412+
?timerPickerMinuteLabelMany,
413+
?timerPickerMinuteLabelOther,
414414
];
415415

416416
/// Subclasses should provide the optional zero pluralization of [timerPickerSecondLabel] based on the ARB file.
@@ -453,12 +453,12 @@ abstract class GlobalCupertinoLocalizations implements CupertinoLocalizations {
453453

454454
@override
455455
List<String> get timerPickerSecondLabels => <String>[
456-
if (timerPickerSecondLabelZero != null) timerPickerSecondLabelZero!,
457-
if (timerPickerSecondLabelOne != null) timerPickerSecondLabelOne!,
458-
if (timerPickerSecondLabelTwo != null) timerPickerSecondLabelTwo!,
459-
if (timerPickerSecondLabelFew != null) timerPickerSecondLabelFew!,
460-
if (timerPickerSecondLabelMany != null) timerPickerSecondLabelMany!,
461-
if (timerPickerSecondLabelOther != null) timerPickerSecondLabelOther!,
456+
?timerPickerSecondLabelZero,
457+
?timerPickerSecondLabelOne,
458+
?timerPickerSecondLabelTwo,
459+
?timerPickerSecondLabelFew,
460+
?timerPickerSecondLabelMany,
461+
?timerPickerSecondLabelOther,
462462
];
463463

464464
/// A [LocalizationsDelegate] for [CupertinoLocalizations].

packages/integration_test/test/binding_fail_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Future<Map<String, dynamic>?> _runTest(String scriptPath) async {
9191
if (json is List<dynamic>) {
9292
return json.cast();
9393
}
94-
return <Map<String, dynamic>>[if (json != null) json as Map<String, dynamic>];
94+
return <Map<String, dynamic>>[?json as Map<String, dynamic>?];
9595
})
9696
.where((Map<String, dynamic> testEvent) => testEvent['type'] == 'print')
9797
.map((Map<String, dynamic> printEvent) => printEvent['message'] as String)

0 commit comments

Comments
 (0)