dart-lang / web_socket_channel

StreamChannel wrappers for WebSockets.
https://pub.dev/packages/web_socket_channel
BSD 3-Clause "New" or "Revised" License
425 stars 112 forks source link

Flutter build web failing due to EventStreamProviders #318

Open rnp0728 opened 10 months ago

rnp0728 commented 10 months ago

(editor update: see below - we've reverted the 2.4.2 publish of this package).


While running flutter build web the following error comes up, until yesterday the builds are working properly. The new update on web_socket_channel:2.4.2 affected this error. We are not using this package directly but some of the packages are dependent on it.

ERROR LOGS :

../../../../.pub-cache/hosted/pub.dev/web_socket_channel-2.4.2/lib/src/web_helpers.dart:10:32:
Error: The getter 'EventStreamProviders' isn't defined for the class 'WebSocket'.
 - 'WebSocket' is from 'package:web/src/dom/websockets.dart' ('../../../../.pub-cache/hosted/pub.dev/web-0.3.0/lib/src/dom/websockets.dart').
  Stream<Event> get onOpenX => EventStreamProviders.openEvent.forTarget(this);
                               ^^^^^^^^^^^^^^^^^^^^
../../../../.pub-cache/hosted/pub.dev/web_socket_channel-2.4.2/lib/src/web_helpers.dart:12:7:
Error: The getter 'EventStreamProviders' isn't defined for the class 'WebSocket'.
 - 'WebSocket' is from 'package:web/src/dom/websockets.dart' ('../../../../.pub-cache/hosted/pub.dev/web-0.3.0/lib/src/dom/websockets.dart').
      EventStreamProviders.messageEvent.forTarget(this);
      ^^^^^^^^^^^^^^^^^^^^
../../../../.pub-cache/hosted/pub.dev/web_socket_channel-2.4.2/lib/src/web_helpers.dart:14:7:
Error: The getter 'EventStreamProviders' isn't defined for the class 'WebSocket'.
 - 'WebSocket' is from 'package:web/src/dom/websockets.dart' ('../../../../.pub-cache/hosted/pub.dev/web-0.3.0/lib/src/dom/websockets.dart').
      EventStreamProviders.closeEvent.forTarget(this);
      ^^^^^^^^^^^^^^^^^^^^
../../../../.pub-cache/hosted/pub.dev/web_socket_channel-2.4.2/lib/src/web_helpers.dart:16:7:
Error: The getter 'EventStreamProviders' isn't defined for the class 'WebSocket'.
 - 'WebSocket' is from 'package:web/src/dom/websockets.dart' ('../../../../.pub-cache/hosted/pub.dev/web-0.3.0/lib/src/dom/websockets.dart').
      EventStreamProviders.errorEventSourceEvent.forTarget(this);
      ^^^^^^^^^^^^^^^^^^^^
crimsonsuv commented 10 months ago

Same here

ambitencourt commented 10 months ago

Palliative solution: dependency_overrides: web_socket_channel: 2.4.0

https://github.com/dart-lang/web_socket_channel/issues/316

GabrielCairesDev commented 10 months ago

Palliative solution: dependency_overrides: web_socket_channel: 2.4.0

316

Good!

devoncarew commented 10 months ago

Hi - these most recent issues were likely caused by the release of 2.4.2, which adjusted the dep on package:web in ways that weren't compatible. We're retracted that release - people who have it pinned explicitly will still see it, but it won't be visible to new version solves.

Also, it looks porting this package to use package:web was (unintentionally) a breaking API change - some of the API types exposed from the package are different. We'll track work to address that in a separate issue, but we may revert the 2.4.x range of this package back to using dart:html, and publishing a new 3.0.0 version of this package that's based on package:web.

NotTsunami commented 10 months ago

305 becomes relevant again because 2.4.3 is once-again reliant on pkg:web 0.4.0 or higher, and Flutter has 0.3.0 pinned. Flutter still won't be able to use 2.4.3.

devoncarew commented 10 months ago

This is the same situation for other packages that Flutter pins however. You need to use dependencies that are compatible with the versions that Flutter was built with. For package:web, that's: