Remove unnecessary null checks in dev/*_tests (#118844)

This commit is contained in:
Michael Goderbauer 2023-01-20 17:36:12 -08:00 committed by GitHub
parent 25843bdb5a
commit 70cecf6c9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 6 additions and 11 deletions

View File

@ -20,7 +20,7 @@ const List<AndroidSemanticsAction> ignoredAccessibilityFocusActions = <AndroidSe
]; ];
String adbPath() { 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) { if (androidHome == null) {
return 'adb'; return 'adb';
} else { } else {

View File

@ -19,7 +19,7 @@ class AndroidPlatformView extends StatelessWidget {
this.onPlatformViewCreated, this.onPlatformViewCreated,
this.useHybridComposition = false, this.useHybridComposition = false,
required this.viewType, required this.viewType,
}) : assert(viewType != null); });
/// The unique identifier for the view type to be embedded by this widget. /// The unique identifier for the view type to be embedded by this widget.
/// ///

View File

@ -99,7 +99,7 @@ class TestUrlStrategy extends UrlStrategy {
@override @override
void replaceState(dynamic state, String title, String url) { void replaceState(dynamic state, String title, String url) {
assert(withinAppHistory); assert(withinAppHistory);
if (url == null || url == '') { if (url == '') {
url = currentEntry.url; url = currentEntry.url;
} }
currentEntry = TestHistoryEntry(state, title, url); currentEntry = TestHistoryEntry(state, title, url);

View File

@ -48,8 +48,6 @@ class Memento extends Object with Diagnosticable {
void debugFillProperties(DiagnosticPropertiesBuilder properties) { void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties); super.debugFillProperties(properties);
properties.add(StringProperty('name', name)); properties.add(StringProperty('name', name));
properties.add(FlagProperty('undo', value: undo != null, ifTrue: 'undo'));
properties.add(FlagProperty('redo', value: redo != null, ifTrue: 'redo'));
} }
} }
@ -63,8 +61,7 @@ class UndoableActionDispatcher extends ActionDispatcher implements Listenable {
/// The [maxUndoLevels] argument must not be null. /// The [maxUndoLevels] argument must not be null.
UndoableActionDispatcher({ UndoableActionDispatcher({
int maxUndoLevels = _defaultMaxUndoLevels, int maxUndoLevels = _defaultMaxUndoLevels,
}) : assert(maxUndoLevels != null), }) : _maxUndoLevels = maxUndoLevels;
_maxUndoLevels = maxUndoLevels;
// A stack of actions that have been performed. The most recent action // A stack of actions that have been performed. The most recent action
// performed is at the end of the list. // performed is at the end of the list.

View File

@ -365,9 +365,7 @@ class _OptionsState extends State<Options> {
} }
class _ControlTile extends StatelessWidget { class _ControlTile extends StatelessWidget {
const _ControlTile({required this.label, required this.child}) const _ControlTile({required this.label, required this.child});
: assert(label != null),
assert(child != null);
final String label; final String label;
final Widget child; final Widget child;

View File

@ -43,7 +43,7 @@ class _HardwareKeyDemoState extends State<RawKeyboardDemo> {
return KeyEventResult.ignored; 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) { String _getEnumName(dynamic enumItem) {
final String name = '$enumItem'; final String name = '$enumItem';