llm_json_stream
A streaming JSON parser optimized for LLM responses. Parse JSON reactively as it streams in, with path-based subscriptions and type-safe property access.
1.0.0
35K downloads/mo
#1749 most downloaded on pub.dev
ComsIndeed/llm-json-stream-dart
What this package is like to depend on
Last release 3 months ago
21 May 2026
Ships unpredictably
gaps range from 9 days to 5 months
Nearly every release is documented
notes for 20 of 20 stable releases
Nothing withdrawn
no release was ever pulled
9 months old
20 releases · first in 2025
20 releases in the last 12 months
see the full history below
Release timeline
20 releases · Nov 2025 to May 2026Releases
latest 20-
1.0.021 May 2026Release notes
Open source →Added
- Root Convenience Getters: Added
.asMap,.stream,.future, and.asList()directly toJsonStreamParserfor much simpler root-level interactions.final parser = JsonStreamParser(stream); // Easy root object operations: parser.stream.listen((mapSnapshot) => print(mapSnapshot)); final completeMap = await parser.future;
Fixed
- Native Idempotency (Flicker Fix): Wrapped
StringPropertyStream,MapPropertyStream, andListPropertyStreamreplayable streams inReplayableBroadcastStreamcaching wrappers. This provides perfect reference identity stability for Flutter'sStreamBuilderand animations during widget rebuilds, while perfectly preserving multiple subscriptions and late-subscriber buffer replay.
- Root Convenience Getters: Added
-
0.4.717 Dec 2025 -
0.4.617 Dec 2025Release notes
Open source →Documentation
- Added thinking tag skipper functionality to JsonStreamParser
- New
skipThoughtsparameter to ignore<thinking>...</thinking>tags in the input stream - Set custom thinking tags with
thinkingTagsparameter
final parser = JsonStreamParser( stream, skipThoughts: true, // Enable thinking tag skipping thinkingTags: ('<reasoning>', '</reasoning>') // Custom tags ); - New
- Added thinking tag skipper functionality to JsonStreamParser
-
0.4.513 Dec 2025Release notes
Open source →Documentation
- Renamed repository URLs in README and docs to use
llm-json-stream-dart
- Renamed repository URLs in README and docs to use
-
0.4.407 Dec 2025 -
0.4.307 Dec 2025Release notes
Open source →Documentation
- Fixed broken docs: Removed dartdoc categories that caused broken topic links on pub.dev
-
0.4.207 Dec 2025Release notes
Open source →Documentation
- Enhanced API documentation: Improved documentation comments for all public classes
- Simplified docs structure: Removed experimental dartdoc categories for cleaner pub.dev integration
-
0.4.107 Dec 2025Release notes
Open source →Performance
- StringBuffer optimization: Replaced String concatenation with StringBuffer in delegates and controllers for better memory efficiency
- Type check optimization: Replaced
runtimeType.toString()comparisons withistype checks for faster delegate detection - Set for O(1) lookups: Changed
_valueFirstCharactersfrom List to Set in ListPropertyDelegate
Documentation
- Contributor documentation: Added comprehensive internal architecture docs with Mermaid diagrams
- Architecture overview and system design
- Detailed delegate documentation with state machines
- Property stream and controller architecture
- Data flow examples with sequence diagrams
- Path system, streaming mechanism, and nesting handler explanations
- README links: Added contributor documentation links to the README
-
0.4.030 Nov 2025Release notes
Open source →Added
-
Buffered streams for Maps and Lists: Both
MapPropertyStreamandListPropertyStreamnow support buffered (replayable) streams, matchingStringPropertyStreambehavior.stream(default, recommended): Replays the latest value to new subscribers (BehaviorSubject-style), preventing race conditions when subscribing late.unbufferedStream: Direct access to the live stream without replay, for cases where you need live-only behavior- Memory efficient: Only stores the latest state (O(1) memory), not the full history of emissions
-
onPropertycallback for Maps: Similar toonElementfor lists, maps now support anonPropertycallback that fires when each property starts parsingparser.getMapProperty('user').onProperty((property, key) { print('Property "$key" started parsing'); // Subscribe to property value as it streams }); -
Yap Filter (
closeOnRootComplete): New parser option to stop parsing after the root JSON object/array completes, ignoring any trailing text from the LLMfinal parser = JsonStreamParser(stream, closeOnRootComplete: true); // Stops after root JSON, ignores: "Hope this helps!" -
Observability with
ParseEvent: Monitor parsing events in real-time with theonLogcallbackfinal parser = JsonStreamParser(stream, onLog: (event) { print('[${event.type}] ${event.message}'); });- Event types:
rootStart,mapKeyDiscovered,listElementStart,propertyStart,propertyComplete,stringChunk,yapFiltered - Property-specific logging via
.onLog()method on anyPropertyStream
- Event types:
Changed
MapPropertyStream.streamnow returns a replayable stream that emits the latest state to new subscribersListPropertyStream.streamnow returns a replayable stream that emits the latest state to new subscribers- Breaking: Buffered streams now emit only the latest value (BehaviorSubject-style) instead of full history replay. This prevents O(N²) memory usage on large streams.
Fixed
- Fixed timing issue where
dispose()was called before async completers finished, causing "Parser was disposed before property completed" errors - Fixed memory leak where Map and List buffers stored every intermediate state (now stores only latest)
Migration
If you were relying on the previous behavior where
.streamdidn't replay values:// Before (0.3.x): .stream was unbuffered mapStream.stream.listen(...); // After (0.4.0): Use .unbufferedStream for the same behavior mapStream.unbufferedStream.listen(...); // Or use .stream (recommended) for buffered/replayable behavior mapStream.stream.listen(...); // Will receive latest state immediately -
-
0.3.127 Nov 2025Release notes
Open source →Documentation
- Updated README import statements to use
llm_json_streampackage name
- Updated README import statements to use
-
0.3.027 Nov 2025Release notes
Open source →Fixes:
- Fixed return types for getter methods
- Fixed exports
- Moved all files into
src/folder for better package structure
-
0.2.325 Nov 2025Release notes
Open source →Changes
- Removed
JsonStreamParserControlleras an export - Add type casting getters for
PropertyStreamobjects:asString()asNum()asBool()asMap()asList()
Documentation
- Updated README
- Removed
-
0.2.223 Nov 2025Release notes
Open source →Added
- Added shorthands
- Added streams for lists and maps
Documentation
- Updated README with new demos
-
0.2.117 Nov 2025 -
0.2.017 Nov 2025Release notes
Open source →Fixed
- Fixed
getMapProperty()returning empty maps instead of populated content - Fixed nested lists and maps within parent maps returning null values
- Fixed map property delegates not creating controllers for nested structures before child delegates
- Fixed array element maps (e.g.,
items[0]) not containing their full content
Changed
- Map property delegates now collect all child values (primitives, maps, lists) before completing
- Improved property controller initialization order for complex nested structures
Tests
- Added 166 comprehensive tests for map and list value retrieval across different nesting levels
- Tests cover various chunk sizes (1-50), timing intervals (0-200ms), and nesting depths (1-5 levels)
- Fixed
-
0.1.415 Nov 2025 -
0.1.315 Nov 2025 -
0.1.215 Nov 2025 -
0.1.115 Nov 2025 -
0.1.015 Nov 2025Release notes
Open source →Added
- Initial release of streaming JSON parser optimized for LLM responses
- Path-based property subscriptions with chainable API
- Support for all JSON types: String, Number, Boolean, Null, Map, List
- Array index access and dynamic element callbacks
- Handles leading whitespace before root JSON elements
Features
- Reactive property access: Subscribe to JSON properties as they complete in the stream
- Nested structures: Full support for deeply nested objects and arrays
- Chainable API: Access nested properties with fluent syntax
- Type safety: Typed property streams for all JSON types
- Memory safe: Proper stream lifecycle management and closed stream guards
Fixed
- Root maps completing properly
- Nested maps completing correctly
- List chainable property access working
- "Cannot add event after closing" errors
- Proper delimiter handling between primitives and containers
- Child delegate completion detection