Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pub.dartlang.org/mqtt5_client-3.1.3/lib/mqtt5_browser_client.dart:11:8: Error: Not found: 'dart:html' import 'dart:html'; #20

Closed
spich opened this issue Nov 25, 2021 · 1 comment

Comments

@spich
Copy link

spich commented Nov 25, 2021

I got this on Web version.

lib/mqtt_browser_client.dart: Warning: Interpreting this as package URI, 'package:mojifinal/mqtt_browser_client.dart'.
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/mqtt5_client-3.1.3/lib/mqtt5_browser_client.dart:11:8: Error: Not found: 'dart:html'
import 'dart:html';
^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/mqtt5_client-3.1.3/lib/src/connectionhandling/browser/mqtt_browser_ws_connection.dart:51:16: Error: The method 'WebSocket' isn't defined for the class 'MqttBrowserWsConnection'.

  • 'MqttBrowserWsConnection' is from 'package:mqtt5_client/mqtt5_browser_client.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/mqtt5_client-3.1.3/lib/mqtt5_browser_client.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'WebSocket'.
    client = WebSocket(uriString, protocols);
    ^^^^^^^^^
    /C:/flutter/.pub-cache/hosted/pub.dartlang.org/mqtt5_client-3.1.3/lib/src/connectionhandling/browser/mqtt_browser_ws_connection.dart:114:16: Error: The method 'WebSocket' isn't defined for the class 'MqttBrowserWsConnection'.
  • 'MqttBrowserWsConnection' is from 'package:mqtt5_client/mqtt5_browser_client.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/mqtt5_client-3.1.3/lib/mqtt5_browser_client.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'WebSocket'.
    client = WebSocket(uriString, protocols);
    ^^^^^^^^^
    /C:/flutter/.pub-cache/hosted/pub.dartlang.org/mqtt5_client-3.1.3/lib/src/connectionhandling/browser/mqtt_browser_connection.dart:44:32: Error: 'MessageEvent' isn't a type.
    client.onMessage.listen((MessageEvent e) {
    ^^^^^^^^^^^^

Process finished with exit code 254

@shamblett
Copy link
Owner

I'm not sure what this means -

Warning: Interpreting this as package URI, 'package:mojifinal/mqtt_browser_client.dart'.

but it looks as though your are trying to use the browser client in a flutter environment, which is a server side dev env so you need the server client. The browser client is for use in flutter web development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants