Skip to content

Commit 147d352

Browse files
author
Dennis Trautwein
committed
Let connect() method wait until there is an actual connection
1 parent a79e46e commit 147d352

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/src/remote_devtools_middleware.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,20 @@ class RemoteDevToolsMiddleware extends MiddlewareClass {
5555
this._channel = await this._login();
5656
_setStatus(RemoteDevToolsStatus.starting);
5757
this._relay('START');
58+
59+
await Future (() {
60+
final c = Completer();
61+
this.socket.on(_channel, (String name, dynamic data) {
62+
if (data['type'] == "START") {
63+
_setStatus(RemoteDevToolsStatus.started);
64+
c.complete();
65+
} else {
66+
c.completeError(data);
67+
}
68+
});
69+
return c.future;
70+
});
71+
5872
this.socket.on(_channel, (String name, dynamic data) {
5973
this.handleEventFromRemote(data as Map<String, dynamic>);
6074
});

0 commit comments

Comments
 (0)