apply lint prefer_void_to_null in packages/fuchsia_remote_debug_protocol (#22690)
diff --git a/packages/fuchsia_remote_debug_protocol/examples/drive_todo_list_scroll.dart b/packages/fuchsia_remote_debug_protocol/examples/drive_todo_list_scroll.dart index 0445104..bfe954b 100644 --- a/packages/fuchsia_remote_debug_protocol/examples/drive_todo_list_scroll.dart +++ b/packages/fuchsia_remote_debug_protocol/examples/drive_todo_list_scroll.dart
@@ -22,7 +22,7 @@ /// /// $ dart examples/driver_todo_list_scroll.dart \ /// fe80::8eae:4cff:fef4:9247 eno1 -Future<Null> main(List<String> args) async { +Future<void> main(List<String> args) async { // Log only at info level within the library. If issues arise, this can be // changed to [LoggingLevel.all] or [LoggingLevel.fine] to see more // information. @@ -56,7 +56,7 @@ // Scrolls down 300px. await driver.scroll(find.byType('Scaffold'), 0.0, -300.0, const Duration(milliseconds: 300)); - await Future<Null>.delayed(const Duration(milliseconds: 500)); + await Future<void>.delayed(const Duration(milliseconds: 500)); // Scrolls up 300px. await driver.scroll(find.byType('Scaffold'), 300.0, 300.0, const Duration(milliseconds: 300));
diff --git a/packages/fuchsia_remote_debug_protocol/examples/list_vms_and_flutter_views.dart b/packages/fuchsia_remote_debug_protocol/examples/list_vms_and_flutter_views.dart index 6e3ac67..3a4ff2d 100644 --- a/packages/fuchsia_remote_debug_protocol/examples/list_vms_and_flutter_views.dart +++ b/packages/fuchsia_remote_debug_protocol/examples/list_vms_and_flutter_views.dart
@@ -18,7 +18,7 @@ /// /// $ dart examples/list_vms_and_flutter_views.dart \ /// fe80::8eae:4cff:fef4:9247 eno1 -Future<Null> main(List<String> args) async { +Future<void> main(List<String> args) async { // Log only at info level within the library. If issues arise, this can be // changed to [LoggingLevel.all] or [LoggingLevel.fine] to see more // information.
diff --git a/packages/fuchsia_remote_debug_protocol/lib/src/dart/dart_vm.dart b/packages/fuchsia_remote_debug_protocol/lib/src/dart/dart_vm.dart index 3f81acf..178ad9e 100644 --- a/packages/fuchsia_remote_debug_protocol/lib/src/dart/dart_vm.dart +++ b/packages/fuchsia_remote_debug_protocol/lib/src/dart/dart_vm.dart
@@ -55,7 +55,7 @@ await socket?.close(); if (timer.elapsed < _kConnectTimeout) { _log.info('Attempting to reconnect'); - await Future<Null>.delayed(_kReconnectAttemptInterval); + await Future<void>.delayed(_kReconnectAttemptInterval); return attemptConnection(uri); } else { _log.warning('Connection to Fuchsia\'s Dart VM timed out at ' @@ -181,7 +181,7 @@ /// Disconnects from the Dart VM Service. /// /// After this function completes this object is no longer usable. - Future<Null> stop() async { + Future<void> stop() async { await _peer?.close(); } }
diff --git a/packages/fuchsia_remote_debug_protocol/lib/src/fuchsia_remote_connection.dart b/packages/fuchsia_remote_debug_protocol/lib/src/fuchsia_remote_connection.dart index 1fec7ca..fba3566 100644 --- a/packages/fuchsia_remote_debug_protocol/lib/src/fuchsia_remote_connection.dart +++ b/packages/fuchsia_remote_debug_protocol/lib/src/fuchsia_remote_connection.dart
@@ -135,10 +135,10 @@ await connection._forwardLocalPortsToDeviceServicePorts(); Stream<DartVmEvent> dartVmStream() { - Future<Null> listen() async { + Future<void> listen() async { while (connection._pollDartVms) { await connection._pollVms(); - await Future<Null>.delayed(_kVmPollInterval); + await Future<void>.delayed(_kVmPollInterval); } connection._dartVmEventController.close(); } @@ -218,7 +218,7 @@ /// Any objects that this class returns (including any child objects from /// those objects) will subsequently have its connection closed as well, so /// behavior for them will be undefined. - Future<Null> stop() async { + Future<void> stop() async { for (PortForwarder pf in _forwardedVmServicePorts) { // Closes VM service first to ensure that the connection is closed cleanly // on the target before shutting down the forwarding itself. @@ -369,7 +369,7 @@ final List<E> result = <E>[]; // Helper function loop. - Future<Null> shutDownPortForwarder(PortForwarder pf) async { + Future<void> shutDownPortForwarder(PortForwarder pf) async { await pf.stop(); _stalePorts.add(pf.remotePort); if (queueEvents) { @@ -432,7 +432,7 @@ /// /// If there are new instances of the Dart VM, then connections will be /// attempted (after clearing out stale connections). - Future<Null> _pollVms() async { + Future<void> _pollVms() async { await _checkPorts(); final List<int> servicePorts = await getDeviceServicePorts(); for (int servicePort in servicePorts) { @@ -456,7 +456,7 @@ /// Runs a dummy heartbeat command on all Dart VM instances. /// /// Removes any failing ports from the cache. - Future<Null> _checkPorts([bool queueEvents = true]) async { + Future<void> _checkPorts([bool queueEvents = true]) async { // Filters out stale ports after connecting. Ignores results. await _invokeForAllVms<Map<String, dynamic>>( (DartVm vmService) async { @@ -473,7 +473,7 @@ /// /// When this function is run, all existing forwarded ports and connections /// are reset by way of [stop]. - Future<Null> _forwardLocalPortsToDeviceServicePorts() async { + Future<void> _forwardLocalPortsToDeviceServicePorts() async { await stop(); final List<int> servicePorts = await getDeviceServicePorts(); final List<PortForwarder> forwardedVmServicePorts = @@ -543,7 +543,7 @@ int get remotePort; /// Shuts down and cleans up port forwarding. - Future<Null> stop(); + Future<void> stop(); } /// Instances of this class represent a running SSH tunnel. @@ -628,7 +628,7 @@ /// Kills the SSH forwarding command, then to ensure no ports are forwarded, /// runs the SSH 'cancel' command to shut down port forwarding completely. @override - Future<Null> stop() async { + Future<void> stop() async { // Cancel the forwarding request. See [start] for commentary about why this // uses the IPv4 loopback. final String formattedForwardingUrl =
diff --git a/packages/fuchsia_remote_debug_protocol/test/fuchsia_remote_connection_test.dart b/packages/fuchsia_remote_debug_protocol/test/fuchsia_remote_connection_test.dart index 7d266d3..b282f17 100644 --- a/packages/fuchsia_remote_debug_protocol/test/fuchsia_remote_connection_test.dart +++ b/packages/fuchsia_remote_debug_protocol/test/fuchsia_remote_connection_test.dart
@@ -147,7 +147,7 @@ }); test('env variable test without remote addr', () async { - Future<Null> failingFunction() async { + Future<void> failingFunction() async { await FuchsiaRemoteConnection.connect(); }
diff --git a/packages/fuchsia_remote_debug_protocol/test/src/dart/dart_vm_test.dart b/packages/fuchsia_remote_debug_protocol/test/src/dart/dart_vm_test.dart index 9df970f..31d1d32 100644 --- a/packages/fuchsia_remote_debug_protocol/test/src/dart/dart_vm_test.dart +++ b/packages/fuchsia_remote_debug_protocol/test/src/dart/dart_vm_test.dart
@@ -199,7 +199,7 @@ final DartVm vm = await DartVm.connect(Uri.parse('http://whatever.com/ws')); expect(vm, isNot(null)); - Future<Null> failingFunction() async { + Future<void> failingFunction() async { await vm.getAllFlutterViews(); } @@ -279,7 +279,7 @@ final DartVm vm = await DartVm.connect(Uri.parse('http://whatever.com/ws')); expect(vm, isNot(null)); - Future<Null> failingFunction() async { + Future<void> failingFunction() async { await vm.getAllFlutterViews(); } @@ -312,7 +312,7 @@ final DartVm vm = await DartVm.connect(Uri.parse('http://whatever.com/ws')); expect(vm, isNot(null)); - Future<Null> failingFunction() async { + Future<void> failingFunction() async { await vm.invokeRpc('somesillyfunction', timeout: timeoutTime); }
diff --git a/packages/fuchsia_remote_debug_protocol/test/src/runners/ssh_command_runner_test.dart b/packages/fuchsia_remote_debug_protocol/test/src/runners/ssh_command_runner_test.dart index 29554d7..46c4fc6 100644 --- a/packages/fuchsia_remote_debug_protocol/test/src/runners/ssh_command_runner_test.dart +++ b/packages/fuchsia_remote_debug_protocol/test/src/runners/ssh_command_runner_test.dart
@@ -96,7 +96,7 @@ address: addr); when<String>(mockProcessResult.stdout).thenReturn('whatever'); when(mockProcessResult.exitCode).thenReturn(1); - Future<Null> failingFunction() async { + Future<void> failingFunction() async { await runner.run('oihaw'); }