Open skaba opened 2 years ago
The package was tested and intended for mobile use. Feel free to create a PR if you get it working on web.
That library uses EventSource
from dart:html
, which afaik is the only working way to use sse on flutter web. However, importing dart:html
will raise Error: Not found
when targeting at mobile platforms. And dart/flutter doesn't support conditional import, so it seems that we can't have both mobile and browser compatibility at library level. (See below)
dart/flutter doesn't support conditional import
@foxB612 I have seen conditional imports in some libraries that I use.
export 'send_port_io.dart' if (dart.library.html) 'send_port_web.dart';
These are from worker_manager package.
import 'package:worker_manager_v2/src/worker/worker_web.dart'
if (dart.library.io) 'package:worker_manager_v2/src/worker/worker_io.dart';
@srix55 Thank you for pointing out that. I did get it wrong. According to the document conditional export/import is supported.
Is it still not working on the web? I do not receive any event until it is disconnected that they all arrive
The package was tested and intended for mobile use. Feel free to create a PR if you get it working on web.
Then remove the Web tag on pub.dev this prevents misunderstandings.
For everyone else
I found this issue regarding http on browser for streams
https://github.com/dart-lang/http/issues/593
Looks like streaming with http buffers the data first which is an issue I am hitting
Should the browser version wrap dart sse client (https://pub.dev/documentation/sse/latest/client_sse_client/SseClient-class.html) instead of using http client?