squint_json library

Lightweight JSON processing code generator. Safely deserialize JSON decoded Strings to Dart Types.


AbstractType ast
Main type parent implemented by:
Result returned after analysing a File analyze.
ArrayDecodingKeyGenerator decoder
Generate a key which describes the exact position of a value inside a nested List.
BooleanType ast
A Boolean StandardType.
BracketCounter decoder
Utility to count brackets and determine which content is inside the same bracket pairs.
CustomType ast
A custom class definition.
DoubleType ast
A double StandardType.
Either<T, R>
Either wrapper containing one of T or R.
EnumType ast
A custom enumeration definition.
Float32ListType ast
A Float32List StandardType.
Float64ListType ast
A Float64List StandardType.
Int32ListType ast
A Int32List StandardType.
Int64ListType ast
A Int64List StandardType.
IntType ast
A Integer StandardType.
JsonArray<T> ast decoder encoder
A JSON element containing an Array value.
JsonArrayOrNull<T> ast decoder encoder
A JSON element containing an Array value or null.
JsonBoolean ast decoder encoder
A JSON element containing a bool value.
JsonBooleanOrNull ast decoder encoder
A JSON element containing a bool value or null.
JsonDecode<T, R> decoder encoder
Decode a JsonNode to a non-standard dart type.
JsonEncode<T> decoder encoder
Encode a (non-standard) dart type to a JsonNode.
JsonFloatingNumber ast decoder encoder
A JSON element containing a double value.
JsonFloatingNumberOrNull ast decoder encoder
A JSON element containing a double value or null.
JsonFormattingOptions encoder
Options to configure JSON formatting.
JsonIntegerNumber ast decoder encoder
A JSON element containing an int value.
JsonIntegerNumberOrNull ast decoder encoder
A JSON element containing an int value or null.
A JsonObject which children are all of the same type.
JsonMissing ast decoder encoder
A JSON element containing a null value and key.
JsonNode<T> ast decoder encoder
A single JSON node representation consisting of a String key and T data.
JsonNull ast decoder encoder
A JSON element containing a null value.
JsonObject ast decoder encoder
JSON Object (Map) element.
JsonObjectOrNull ast decoder encoder
JSON Object (Map) element.
JsonString ast decoder encoder
A JSON element containing a String value.
JsonStringOrNull ast decoder encoder
A JSON element containing a String or null value.
JsonValue decoder encoder
Set value of field with value of JsonNode with name.
Representation of a closing bracket, e.g. '['.
Representation of an opening bracket, e.g. '['.
ListType ast
A List StandardType.
Representation of characters who separate values inside a List, e.g. a comma: ','.
A token representing a character inside a List value.
MapType ast
A Map StandardType.
NullableBooleanType ast
A nullable Boolean StandardType.
NullableDoubleType ast
A nullable double StandardType.
NullableFloat32ListType ast
A nullable Float32List StandardType.
NullableFloat64ListType ast
A nullable Float64List StandardType.
NullableInt32ListType ast
A nullable Int32List StandardType.
NullableInt64ListType ast
A nullable Int64List StandardType.
NullableIntType ast
A nullable Integer IntType.
NullableListType ast
A nullable List StandardType.
NullableMapType ast
A nullable Map MapType.
NullableStringType ast
A nullable String StandardType.
NullableUint8ListType ast
A nullable Uint8List StandardType.
Representation of a opening squiggly bracket, e.g. '{'.
SquintGeneratorOptions generator
Options to configure code generation.
StandardType ast
A standard Dart type being one of:
StringType ast
A String StandardType.
TypeAnnotation ast
Annotation data.
TypeMember ast
A class type member (field).
Uint8ListType ast
A Uint8List StandardType.


JsonIndentationSize encoder
Length of indentation per level.


AbstractTypeFromString on String decoder
Find matching AbstractType for String value.
AbstractTypeNormalizer on AbstractType
Utility to normalize user defined Types.
AbstractTypeSerializer on AbstractType analyzer
CustomType2DataClass on CustomType generator
Convert a CustomType to a data class.
DecoderMethod on AbstractType
Output decoding method line.
EnumType2EnumClass on EnumType generator
Convert a EnumType to an enum class.
FileAnalyzer on File analyzer
FileUtil on Directory
File processing utilities.
ImportsBuilder on CustomType
Print import statements.
JsonArrayDecoder on String decoder
Decode a JSON Array String.
JsonConversionExtensionsGenerator on CustomType generator
Generate JSON (de)serialization methods for a dart class CustomType.
JsonDecoder on String decoder
Decoded a JSON String as JsonObject.
JsonFormatter on String encoder
Utilities to format a JSON String,
JsonFormattingOptionsBuilder on JsonFormattingOptions encoder
Helper to customize JsonFormattingOptions.
JsonNodeEnumGenerator on EnumType generator
Utilities to generate getters/setters for enum classes and serializers.
JsonNodeGenerator on List<TypeMember> generator
Utilities to generate getter/setters for dataclasses and serializers.
JsonValueExtensionsGenerator on EnumType generator
Generate JSON (de)serialization methods for an enum class EnumType.
ListDecoder on List decoder
Decode a Dart List.
ListProcessor on Iterable<T>
List processing utilities.
Logger on String
Helper for logging.
MapProcessor on Map<K, V>
Map processing utilities.
NoneValueBuilder on EnumType
Return String enum value for empty JSON String.
RegexValues on RegExpMatch
Regex processing utilities.
RepeatedBuilder on Map<String, JsonNode> decoder
Utility to construct a nested List structure with strongly typed children.
SquintGeneratorOptionsBuilder on SquintGeneratorOptions generator
Builder to customize SquintGeneratorOptions without building an instance from scratch.
StringUtils on String
String processing utilities.
UnquotedSpaceRemover on List<String>
Utility to remove all meaningless spaces from a JSON String.


metadataMarkerPrefix → const String analyzer
Marker prefix used for metadata debug files.
noAnnotationsGeneratorOptions → const SquintGeneratorOptions generator
Generate data class without annotations.
squint → const _Squint decoder encoder
All classes annotated with @squint will be processed by the squint library.
standardJsonFormatting → const JsonFormattingOptions encoder
Default JSON formatting options.
standardNullableTypes → const Map<String, StandardType> ast
Map of all standard nullable types.
standardSquintGeneratorOptions → const SquintGeneratorOptions generator
Default code generation options.
standardTypes → const Map<String, StandardType> ast
Map of all standard types.


mapRegex RegExp decoder
Regex to match a Map from literal value:


analyze({String? pathToFile, String? fileContent, String? pathToOutputFolder, bool overwrite = true}) AnalysisResult analyzer
The analyzer can read files and return metadata about (dart) classes.
buildListStructure<T>(List<List<int>> positions, {List<T>? valueList}) List decoder
Build a nested List which has all required children to set all values.
dynamicValue({required String key, dynamic data}) → UntypedJsonNode
JSON node of unknown type.
getNestedBoolList(int depth) List
Get a List
getNestedDoubleList(int depth) List
Get a List
getNestedIntList(int depth) List
Get a List
getNestedList<T>({required int depth, required List<T> valueList}) List
Get a List
getNestedNullableBoolList(int depth) List
Get nested List with a nullable bool child. See getNestedBoolList.
getNestedNullableDoubleList(int depth) List
Get nested List with a nullable double child. See getNestedDoubleList.
getNestedNullableIntList(int depth) List
Get nested List with a nullable int child. See getNestedIntList.
getNestedNullableStringList(int depth) List
Get nested List with a nullable String child. See getNestedStringList.
getNestedStringList(int depth) List
Get a List
maybeAddQuotes(dynamic value) → dynamic encoder
Return a quoted String value for JSON if the current value is a String.
toJsonObject(String json) JsonObject decoder
Decode a JSON String as JsonObject.

Exceptions / Errors

Exception indicating a problem in the Squint library either internally or by faulty configuration.