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';
///
/// $ 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 @@ Future<Null> main(List<String> args) async {
// 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));
......
......@@ -18,7 +18,7 @@ import 'package:fuchsia_remote_debug_protocol/logging.dart';
///
/// $ 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.
......
......@@ -55,7 +55,7 @@ Future<json_rpc.Peer> _waitAndConnect(Uri uri) async {
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 @@ class DartVm {
/// 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();
}
}
......
......@@ -135,10 +135,10 @@ class FuchsiaRemoteConnection {
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 @@ class FuchsiaRemoteConnection {
/// 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 @@ class FuchsiaRemoteConnection {
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 @@ class FuchsiaRemoteConnection {
///
/// 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 @@ class FuchsiaRemoteConnection {
/// 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 @@ class FuchsiaRemoteConnection {
///
/// 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 @@ abstract class PortForwarder {
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 @@ class _SshPortForwarder implements PortForwarder {
/// 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 =
......
......@@ -147,7 +147,7 @@ void main() {
});
test('env variable test without remote addr', () async {
Future<Null> failingFunction() async {
Future<void> failingFunction() async {
await FuchsiaRemoteConnection.connect();
}
......
......@@ -199,7 +199,7 @@ void main() {
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 @@ void main() {
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 @@ void main() {
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);
}
......
......@@ -96,7 +96,7 @@ void main() {
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');
}
......
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