EventFlux는 서버 전송 이벤트(SSE) 스트림을 효율적으로 관리하기 위해 설계된 Flutter/Dart 패키지입니다. SSE 엔드포인트에 대한 원활한 연결, 자동 재연결 처리 및 구조화된 데이터 처리를 제공하여 실시간 데이터 통신을 간소화합니다. 알림, 대시보드 또는 라이브 피드와 같이 실시간 업데이트가 필요한 애플리케이션에 적합하며, 최소한의 보일러플레이트로 신뢰할 수 있는 이벤트 전달을 보장합니다. Android, iOS, macOS, Windows, Linux 등 여러 플랫폼을 지원하여 크로스플랫폼 실시간 앱에 적합합니다.
사용 사례
실시간 알림
실시간 대시보드 업데이트
스트리밍 데이터 피드
채팅 애플리케이션
모니터링 시스템
주요 기능
자동 재연결
스트림 라이프사이클 관리
크로스 플랫폼 지원
이벤트 처리를 위한 간단한 API
내장 오류 복구
적합한 대상
실시간 앱 개발자
백엔드 통합 플러터 앱
실시간 데이터 업데이트가 필요한 앱
서버 전송 이벤트를 사용하는 팀
다중 플랫폼 프로젝트
고려 사항
SSE 호환 백엔드 필요
서버에서 클라이언트로의 스트리밍에 한정
내장 인증 처리 없음
네트워크 안정성에 따라 다릅니다
복잡한 페이로드를 처리하기 위해 사용자 정의 파싱이 필요할 수 있습니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
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