Imgkl / EventFlux

A Dart package for efficient handling of server-sent event streams with easy connectivity and data management.
https://pub.dev/packages/eventflux
MIT License
25 stars 8 forks source link

Browser Support #5

Open Imgkl opened 9 months ago

Imgkl commented 9 months ago

References

Imgkl commented 8 months ago

The fetch_api package is intended for web use, which would explain why it's relying on dart:js. However, this becomes an issue when you try to run your Flutter app on platforms other than the web because the package is not compatible with non-web environments. Just by importing it in the package, seems to cause issue.

Possible Solutions:

The-RootCause commented 5 months ago

Any updates on this issue ? It's very important to start using EventFlux. Thank you

Zekfad commented 5 months ago

Hi, I'm fetch_client author.

Was checking usage of package and stumbled upon this issue. We've fixed it in last version, so you can now import client in VM (it will throw UnsupportedError is you try to instantiate it).

As a side note, when you use web only package (which uses js_interop or dart:html) you should do conditional import like in this example from package:http: https://github.com/dart-lang/http/blob/dd31e64685b03a9700cc99d7b7fc637dd60c4d3a/pkgs/flutter_http_example/lib/main.dart#L13-L14

Hope this will help to resolve this!