Package selection guidance compiled from public package information, community data, and project usage.
EventFlux is a Flutter/Dart package designed for efficient management of server-sent event (SSE) streams. It simplifies real-time data communication by providing seamless connectivity to SSE endpoints, automatic reconnection handling, and structured data processing. Ideal for applications requiring live updates such as notifications, dashboards, or live feeds, EventFlux ensures reliable event delivery with minimal boilerplate. The package supports multiple platforms including Android, iOS, macOS, Windows, and Linux, making it suitable for cross-platform real-time apps.
Use cases
Real-time notifications
Live dashboard updates
Streaming data feeds
Chat applications
Monitoring systems
Key features
Automatic reconnection
Stream lifecycle management
Cross-platform support
Simple API for event handling
Built-in error recovery
Suitable for
Real-time app developers
Backend-integrated Flutter apps
Apps needing live data updates
Teams using server-sent events
Multi-platform projects
Considerations
Requires SSE-compatible backend
Limited to server-to-client streaming
No built-in authentication handling
Depends on network stability
May need custom parsing for complex payloads
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
EventFlux
A Dart package for Server-Sent Events done right — WHATWG spec-compliant parsing, auto-reconnect with exponential backoff, request/response interceptors, mid-flight abort, idle timeout detection, and web platform support out of the box.
Platform Support
Android
iOS
Web
MacOS
Windows
Linux
✅
✅
✅
✅
❓
❓
Windows and Linux should work but haven't been battle-tested yet — PRs welcome if you get there first.
Features 🌟
📜 WHATWG SSE spec-compliant event stream parsing with persistent lastEventId and retry: field support
🔄 Auto-reconnect with linear or exponential backoff, random jitter, and configurable maxBackoff cap
🔗 Interceptor chain — hook into request, response, and error lifecycle stages
🛑 Mid-flight abort via a Future<void> trigger
⏱️ Idle timeout detection — drops the connection if no data arrives within a configured duration
🌐 Web platform support with CORS, credentials, and caching configuration via WebConfig
🔍 Event filtering by type using response.where()
📎 Multipart request support
🏗️ Singleton (EventFlux.instance) and multiple independent connections (EventFlux.spawn())
🔌 Pluggable HTTP clients via HttpClientAdapter
🧠 Smart error classification — only 5xx, 408, and 429 trigger auto-reconnect
Migrating from v2? FYI. 🔄
Here
If you're upgrading from v2, here's what changed:
Breaking
onReconnect callback signature changed from () to (int attempt, Duration delay)
Default request headers now include Cache-Control: no-store
Minimum Dart SDK raised to >=3.4.0, Flutter >=3.0.0
webConfig is now required when running on web
New in v3
EventFluxStatus.reconnecting status value
originalError and stackTrace fields on EventFluxException
Request/response/error interceptor chain via interceptors parameter
Mid-flight abort support via abortTrigger parameter
Idle timeout detection via connectionTimeout on ReconnectConfig
maxBackoff on ReconnectConfig to cap exponential backoff
WHATWG-compliant SSE parser with persistent lastEventId, retry: field support, and U+2028 sanitization
Installation 📦
dependencies:eventflux:^3.0.2-dev
Requires Dart SDK >=3.4.0 and Flutter >=3.0.0.
Usage 🔧
Basic Connection — Connect to an SSE endpoint in a few lines