Unverified Commit c26b56cb authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

apply lint prefer_void_to_null in packages/fuchsia_remote_debug_protocol (#22690)

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