Change Future.done to Future.whenComplete (#36270)

This is for the missed comment in
https://github.com/flutter/flutter/pull/36089#discussion_r303960949
This commit is contained in:
liyuqian
2019-07-19 13:01:42 -07:00
committed by Kate Lovett
parent 5e650af7fa
commit 50a483879f

View File

@@ -409,7 +409,7 @@ class FlutterDriver {
final String webSocketUrl = _getWebSocketUrl(_dartVmReconnectUrl);
final WebSocket ws = await WebSocket.connect(webSocketUrl);
ws.done.then((dynamic _) => _checkCloseCode(ws));
ws.done.whenComplete(() => _checkCloseCode(ws));
_peer = rpc.Peer(
IOWebSocketChannel(ws).cast(),
onUnhandledError: _unhandledJsonRpcError,
@@ -1138,8 +1138,8 @@ Future<VMServiceClientConnection> _waitAndConnect(String url) async {
ws1 = await WebSocket.connect(webSocketUrl);
ws2 = await WebSocket.connect(webSocketUrl);
ws1.done.then((dynamic _) => _checkCloseCode(ws1));
ws2.done.then((dynamic _) => _checkCloseCode(ws2));
ws1.done.whenComplete(() => _checkCloseCode(ws1));
ws2.done.whenComplete(() => _checkCloseCode(ws2));
return VMServiceClientConnection(
VMServiceClient(IOWebSocketChannel(ws1).cast()),