Skip to content
This repository has been archived by the owner on Feb 7, 2022. It is now read-only.

Cannot connect to server on Flutter web #9

Open
juliusarden opened this issue Nov 28, 2019 · 0 comments
Open

Cannot connect to server on Flutter web #9

juliusarden opened this issue Nov 28, 2019 · 0 comments

Comments

@juliusarden
Copy link

ddpClient.connect() cannot be run on the web.

...
  onPressed: () {
      DdpClient client =
          DdpClient(xxx, xxx, xxx);
      client.connect(); // Died on this line
  },

This code works fine on mobile (IOS and Android), it does not work for web.
Here is the error message:

══╡ EXCEPTION CAUGHT BY GESTURE ╞═══════════════════════════════════════════════════════════════════
js_primitives.dart:30 The following UnsupportedError was thrown while handling a gesture:
js_primitives.dart:30 Unsupported operation: Platform._version
js_primitives.dart:30 
js_primitives.dart:30 When the exception was thrown, this was the stack:
js_primitives.dart:30 package:dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 194:49  throw_
js_primitives.dart:30 package:dart-sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart 284:5               _version
js_primitives.dart:30 package:dart-sdk/lib/io/platform_impl.dart 121:32                                     get version
js_primitives.dart:30 package:dart-sdk/lib/io/platform.dart 74:37                                           get _version
js_primitives.dart:30 package:dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/utils.dart 75:6     get
js_primitives.dart:30 package:dart-sdk/lib/io/platform.dart 231:32                                          get version
js_primitives.dart:30 package:dart-sdk/lib/_http/http_impl.dart 3234:26                                     _getHttpVersion
js_primitives.dart:30 package:dart-sdk/lib/_http/http_impl.dart 2071:22                                     new
js_primitives.dart:30 package:dart-sdk/lib/_http/http.dart 1473:18                                          new
js_primitives.dart:30 package:dart-sdk/lib/_http/websocket_impl.dart 993:45                                 get _httpClient
js_primitives.dart:30 package:dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/utils.dart 75:6     get
js_primitives.dart:30 package:dart-sdk/lib/_http/websocket_impl.dart 1046:8                                 connect
js_primitives.dart:30 package:dart-sdk/lib/_http/websocket.dart 380:22                                      connect
js_primitives.dart:30 package:ddp/ddp_client.dart 137:8                                                     connect
...
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant