Remove unnecessary null checks in flutter_driver (#118864)
This commit is contained in:
committed by
GitHub
parent
83720015a4
commit
288a7733e5
@@ -432,11 +432,6 @@ abstract class FlutterDriver {
|
||||
double dyScroll = 0.0,
|
||||
Duration? timeout,
|
||||
}) async {
|
||||
assert(scrollable != null);
|
||||
assert(item != null);
|
||||
assert(alignment != null);
|
||||
assert(dxScroll != null);
|
||||
assert(dyScroll != null);
|
||||
assert(dxScroll != 0.0 || dyScroll != 0.0);
|
||||
|
||||
// Kick off an (unawaited) waitFor that will complete when the item we're
|
||||
@@ -509,7 +504,6 @@ abstract class FlutterDriver {
|
||||
/// invoked when the widget is focused, as the [SystemChannels.textInput]
|
||||
/// channel will be mocked out.
|
||||
Future<void> setTextEntryEmulation({ required bool enabled, Duration? timeout }) async {
|
||||
assert(enabled != null);
|
||||
await sendCommand(SetTextEntryEmulation(enabled, timeout: timeout));
|
||||
}
|
||||
|
||||
@@ -537,7 +531,6 @@ abstract class FlutterDriver {
|
||||
///
|
||||
Future<void> sendTextInputAction(TextInputAction action,
|
||||
{Duration? timeout}) async {
|
||||
assert(action != null);
|
||||
await sendCommand(SendTextInputAction(action, timeout: timeout));
|
||||
}
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ class VMServiceFlutterDriver extends FlutterDriver {
|
||||
// Let subsequent isolates start automatically.
|
||||
try {
|
||||
final vms.Response result = await client.setFlag('pause_isolates_on_start', 'false');
|
||||
if (result == null || result.type != 'Success') {
|
||||
if (result.type != 'Success') {
|
||||
_log('setFlag failure: $result');
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -348,7 +348,6 @@ class VMServiceFlutterDriver extends FlutterDriver {
|
||||
_log(message);
|
||||
}
|
||||
if (_logCommunicationToFile) {
|
||||
assert(_logFilePathName != null);
|
||||
final f.File file = fs.file(_logFilePathName);
|
||||
file.createSync(recursive: true); // no-op if file exists
|
||||
file.writeAsStringSync('${DateTime.now()} $message\n', mode: f.FileMode.append, flush: true);
|
||||
@@ -380,8 +379,7 @@ class VMServiceFlutterDriver extends FlutterDriver {
|
||||
List<TimelineStream> streams = const <TimelineStream>[TimelineStream.all],
|
||||
Duration timeout = kUnusuallyLongTimeout,
|
||||
}) async {
|
||||
assert(streams != null && streams.isNotEmpty);
|
||||
assert(timeout != null);
|
||||
assert(streams.isNotEmpty);
|
||||
try {
|
||||
await _warnIfSlow<vms.Success>(
|
||||
future: _serviceClient.setVMTimelineFlags(
|
||||
@@ -405,7 +403,6 @@ class VMServiceFlutterDriver extends FlutterDriver {
|
||||
int? startTime,
|
||||
int? endTime,
|
||||
}) async {
|
||||
assert(timeout != null);
|
||||
assert((startTime == null && endTime == null) ||
|
||||
(startTime != null && endTime != null));
|
||||
|
||||
@@ -497,7 +494,6 @@ class VMServiceFlutterDriver extends FlutterDriver {
|
||||
Future<void> clearTimeline({
|
||||
Duration timeout = kUnusuallyLongTimeout,
|
||||
}) async {
|
||||
assert(timeout != null);
|
||||
try {
|
||||
await _warnIfSlow<vms.Success>(
|
||||
future: _serviceClient.clearVMTimeline(),
|
||||
@@ -630,9 +626,6 @@ Future<T> _warnIfSlow<T>({
|
||||
required Duration timeout,
|
||||
required String message,
|
||||
}) async {
|
||||
assert(future != null);
|
||||
assert(timeout != null);
|
||||
assert(message != null);
|
||||
final Completer<void> completer = Completer<void>();
|
||||
completer.future.timeout(timeout, onTimeout: () {
|
||||
_log(message);
|
||||
|
||||
@@ -174,7 +174,6 @@ class WebFlutterDriver extends FlutterDriver {
|
||||
driverLog('WebFlutterDriver', message);
|
||||
}
|
||||
if (_logCommunicationToFile) {
|
||||
assert(_logFilePathName != null);
|
||||
final File file = fs.file(_logFilePathName);
|
||||
file.createSync(recursive: true); // no-op if file exists
|
||||
file.writeAsStringSync('${DateTime.now()} $message\n', mode: FileMode.append, flush: true);
|
||||
|
||||
Reference in New Issue
Block a user