json_events library

Classes

JsonEvent
An event correspoding to the item in a json
JsonEventDecoder
This class parses JSON strings and builds the corresponding events.
JsonTraverser
A base mixin for json values

Enums

JsonEventType
Type of events that can be dispatched

Mixins

JsonArrayTraverser<T>
A mixin for reperesenting an array
JsonNestedArrayTraverser<T extends List, E>
A mixin for representing a nested array
JsonObjectTraverser
A mixin for reperesenting an object

Extensions

JsonTraverserExtensions on JsonTraverser
Utility extensions to load json
StreamExtensions on Stream<Iterable<JsonEvent>>
Extensions for Stream of Iterable of JsonEvents

Functions

readArrayJson<T>({required StreamIterator<JsonEvent> si, FutureOr<T> creator()?, bool callLoader = true}) Stream<T>
Reads the current value as an array from the iterator It is almost same with the readArrayJsonContinue. The difference is that this function assumes the iterator has not moved yet. So it calls StreamIterator.moveNext then calls readArrayJsonContinue
readArrayJsonContinue<T>({required StreamIterator<JsonEvent> si, FutureOr<T> creator()?, bool callLoader = true}) Stream<T>
Reads the current value as an array from the iterator
readCustomObjectJson({required StreamIterator<JsonEvent> si, required FutureOr<void> readJson(String key), FutureOr<void> postProcessJson()?}) Future<void>
It is almost same with the readCustomObjectJsonContinue. The difference is that this function assumes the iterator has not moved yet. So it calls StreamIterator.moveNext then calls readCustomObjectJsonContinue You can use this function for parsing objects that you do not know the type before parsing. For example, polymorphism based on field or $type fields
readCustomObjectJsonContinue({required StreamIterator<JsonEvent> si, required FutureOr<void> readJson(String key), FutureOr<void> postProcessJson()?}) Future<void>
Reads the current value as an object from the iterator
readNestedArrayJson<T extends List, E>({required StreamIterator<JsonEvent> si, FutureOr<E> creator()?, bool callLoader = true}) Stream<T>
It is almost same with the readNestedArrayJsonContinue. The difference is that this function assumes the iterator has not moved yet. So it calls StreamIterator.moveNext then calls readNestedArrayJsonContinue
readNestedArrayJsonContinue<T extends List, E>({required StreamIterator<JsonEvent> si, FutureOr<E> creator()?, bool callLoader = true}) Stream<T>
Reads the current value as a nested array from the iterator
readObjectJson<T extends JsonObjectTraverser>({required StreamIterator<JsonEvent> si, required FutureOr<T> creator()}) Future<T>
It is almost same with the readObjectJsonContinue. The difference is that this function assumes the iterator has not moved yet. So it calls StreamIterator.moveNext then calls readObjectJsonContinue
readObjectJsonContinue<T extends JsonObjectTraverser>({required StreamIterator<JsonEvent> si, required FutureOr<T> creator()}) Future<T>
Reads the current value as an object from the iterator
readPropertyJson<T>({required StreamIterator<JsonEvent> si, T? defaultValue}) Future<T>
It is almost same with the readPropertyJsonContinue. The difference is that this function assumes the iterator has not moved yet. So it calls StreamIterator.moveNext then calls readPropertyJsonContinue
readPropertyJsonContinue<T>({required StreamIterator<JsonEvent> si, T? defaultValue}) Future<T>
Reads the current value as a json value from the iterator