diff --git a/packages/flutter_driver/lib/src/driver.dart b/packages/flutter_driver/lib/src/driver.dart index d80956ce31..d03810229a 100644 --- a/packages/flutter_driver/lib/src/driver.dart +++ b/packages/flutter_driver/lib/src/driver.dart @@ -175,7 +175,7 @@ class FlutterDriver { // At this point the service extension must be installed. Verify it. Health health = await driver.checkHealth(); if (health.status != HealthStatus.ok) { - client.close(); + await client.close(); throw new DriverError('Flutter application health check failed.'); } @@ -371,11 +371,8 @@ Future _waitAndConnect(String url) async { new rpc.Peer(new IOWebSocketChannel(ws2).cast())..listen() ); } catch(e) { - if (ws1 != null) - ws1.close(); - - if (ws2 != null) - ws2.close(); + await ws1?.close(); + await ws2?.close(); if (timer.elapsed < const Duration(seconds: 30)) { _log.info('Waiting for application to start');