ServerSendEvent support for Flutter Web
Open
Nobody has claimed this yet.
e: PR welcomed
p: dio
s: feature
- Dominant language
- Dart
- Stars
- 12.8k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
Request Statement
When request for ServerSendEvent stream on TargetPlatform: Web, it response with a UnsupportedError: RawSocket constructor
Stream<T> requestForServerSendEventStream<T>(String url, Map<String, dynamic> request,
{required void Function(CancelData cancelData) onCancel}) {
final controller = StreamController<T>.broadcast();
final cancelData = CancelData(cancelToken: CancelToken());
try {
onCancel(cancelData);
_dio
.post(url,
cancelToken: cancelData.cancelToken,
data: json.encode(request),
options: Options(responseType: ResponseType.stream))
.then((it) {
it.data.stream.listen((it) {
// ...
}, onDone: () {
controller.close();
}, onError: (err, t) {
// ...
});
}, onError: (err, t) {
// ...
});
} on DioException catch (e) {
// ...
}
return controller.stream;
}
Solution Brainstorm
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing Dio's Flutter Web request path and the RawSocket usage behind the shown ResponseType.stream call. Compare the web adapter with the existing streaming implementation; done means ServerSendEvent requests work on Flutter Web without the UnsupportedError. No specific files or tests are named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100