Skip to content

Commit

Permalink
Remove unnecessary null checks in dev/*_tests (#118844)
Browse files Browse the repository at this point in the history
  • Loading branch information
goderbauer committed Jan 21, 2023
1 parent 25843bd commit 70cecf6
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const List<AndroidSemanticsAction> ignoredAccessibilityFocusActions = <AndroidSe
];

String adbPath() {
final String androidHome = io.Platform.environment['ANDROID_HOME'] ?? io.Platform.environment['ANDROID_SDK_ROOT']!;
final String? androidHome = io.Platform.environment['ANDROID_HOME'] ?? io.Platform.environment['ANDROID_SDK_ROOT'];
if (androidHome == null) {
return 'adb';
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AndroidPlatformView extends StatelessWidget {
this.onPlatformViewCreated,
this.useHybridComposition = false,
required this.viewType,
}) : assert(viewType != null);
});

/// The unique identifier for the view type to be embedded by this widget.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class TestUrlStrategy extends UrlStrategy {
@override
void replaceState(dynamic state, String title, String url) {
assert(withinAppHistory);
if (url == null || url == '') {
if (url == '') {
url = currentEntry.url;
}
currentEntry = TestHistoryEntry(state, title, url);
Expand Down
5 changes: 1 addition & 4 deletions dev/manual_tests/lib/actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ class Memento extends Object with Diagnosticable {
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(StringProperty('name', name));
properties.add(FlagProperty('undo', value: undo != null, ifTrue: 'undo'));
properties.add(FlagProperty('redo', value: redo != null, ifTrue: 'redo'));
}
}

Expand All @@ -63,8 +61,7 @@ class UndoableActionDispatcher extends ActionDispatcher implements Listenable {
/// The [maxUndoLevels] argument must not be null.
UndoableActionDispatcher({
int maxUndoLevels = _defaultMaxUndoLevels,
}) : assert(maxUndoLevels != null),
_maxUndoLevels = maxUndoLevels;
}) : _maxUndoLevels = maxUndoLevels;

// A stack of actions that have been performed. The most recent action
// performed is at the end of the list.
Expand Down
4 changes: 1 addition & 3 deletions dev/manual_tests/lib/density.dart
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,7 @@ class _OptionsState extends State<Options> {
}

class _ControlTile extends StatelessWidget {
const _ControlTile({required this.label, required this.child})
: assert(label != null),
assert(child != null);
const _ControlTile({required this.label, required this.child});

final String label;
final Widget child;
Expand Down
2 changes: 1 addition & 1 deletion dev/manual_tests/lib/raw_keyboard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class _HardwareKeyDemoState extends State<RawKeyboardDemo> {
return KeyEventResult.ignored;
}

String _asHex(int value) => value != null ? '0x${value.toRadixString(16)}' : 'null';
String _asHex(int value) => '0x${value.toRadixString(16)}';

String _getEnumName(dynamic enumItem) {
final String name = '$enumItem';
Expand Down

0 comments on commit 70cecf6

Please sign in to comment.