flutter_sse_flow 0.1.0
flutter_sse_flow: ^0.1.0 copied to clipboard
A robust Server-Sent Events (SSE) client for Flutter, featuring automatic reconnections, stream parsing, and OIDC automated publishing.
0.1.0 #
Added #
- Dynamic Header Provider (
SseHeadersProvider): Support dynamically resolving headers before every connection and automatic reconnection attempt, enabling transparent token rotation. - Auth-aware Recovery (
onUnauthorized&SseAuthDecision): Handle 401/403 status codes by refreshing credentials and returningSseAuthDecision.retryorSseAuthDecision.stop. - Bounded Auth Retries (
maxAuthRetries): Added configurablemaxAuthRetries(default 10) to prevent infinite connection loops when credentials remain rejected. - Automatic
Last-Event-IDResumption: Automatically tracks received event IDs and includes theLast-Event-IDheader on reconnects. - Connection Lifecycle Monitoring (
SseConnectionStatus&statusStream): Observe granular lifecycle states (idle,connecting,connected,reconnecting,refreshingAuth,unauthorized,disconnected). - Resource Cleanup (
dispose): Permanently close internal stream controllers and terminate active connections.
Fixed #
- Race Condition Prevention: Implemented
SseSessioncancellation token pattern so rapiddisconnect()followed byconnect()never results in concurrent loops or duplicate events. - Keep-Alive Comment Parsing: Pure comment blocks (e.g.
:keep-alive\n\n) no longer emit emptySSEModelinstances into the stream.
Changed #
- Breaking Change:
connect()parameterheadersnow accepts aSseHeadersProvider?callback (FutureOr<Map<String, String>> Function()) instead of a staticMap<String, String>?.
0.0.2 #
- Updated
README.mdwith comprehensive, separate English and Vietnamese documentation sections. - Added detailed API reference tables and usage examples.
- Cleaned up test imports for
flutter analyzecompliance.
0.0.1 #
- Initial release of
flutter_sse_flow. - Added robust Server-Sent Events (SSE) client implementation (
FlutterSseFlow). - Added
SSEModelto represent event data. - Handled automatic reconnections and edge cases like 401 Unauthorized.
- Implemented proper SSE stream parsing using
utf8.decoderandLineSplitter. - Configured automated publishing to pub.dev via GitHub Actions with OIDC.
- Added unit tests for
FlutterSseFlowandSSEModel.