Skip to content
pubscout

flutter_client_sse

2.0.3, released 2 years ago by hustlecreatives.dev

Consume Server-Sent Events (SSE) APIs with support for GET and POST requests.

WASM-ready
$ flutter pub add flutter_client_sse
Source repository

What it does

Allows Flutter and Dart applications to connect to Server-Sent Events endpoints using GET or POST requests with custom headers and body payloads. It streams parsed events providing the event ID, event type, and data payload.

AI-written summary of version 2.0.3, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to consume a Server-Sent Events (SSE) stream from a backend
  • You need to send custom headers or a request body with your SSE connection

Skip it when

  • You are using WebSockets for bidirectional real-time communication

Strengths

  • Supports both GET and POST requests for SSE
  • Auto-retry mechanism for connection errors and backend downtime
  • Parses event id, event type, and data out of the box

Weaknesses

  • Limited documentation outside of basic README examples
  • Topics not documented

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
1

Not documented

SSEClient.subscribeToSSE(
    method: SSERequestType.GET,
    url: 'http://192.168.1.2:3000/api/activity-stream',
    header: {
        "Accept": "text/event-stream",
    }).listen((event) {
        print('Id: ' + event.id!);
        print('Event: ' + event.event!);
        print('Data: ' + event.data!);
    },
);

Alternatives

Packages that do the same job and could replace flutter_client_sse.

  • eventflux

    A Server-Sent Events client for Dart and Flutter with auto-reconnection.

  • sse

    Bidirectional Server Sent Events client and server for Dart.

  • sse_channel

    Wraps Server‑Sent Events as a StreamChannel for Dart IO and web

  • flutter_http_sse

    Flutter client library for receiving Server-Sent Events (SSE) over HTTP.

Works with

Packages commonly used together with flutter_client_sse: ones it builds on, ones built on it, and its own family.