JsonString class

A single piece of JSON data.

Constructors

JsonString(String source, {bool enableCache = false})
Constructs a JsonString if source is a valid JSON.
factory
JsonString.encode(Object? value, {ToEncodable? encoder})
Constructs a JsonString converting value into a valid JSON.

Properties

decodedValue → dynamic
The JSON data directly decoded as a dynamic type.
no setter
decodedValueAsList List
The JSON data decoded as an instance of List<dynamic>.
no setter
decodedValueAsMap Map<String, dynamic>
The JSON data decoded as an instance of Map<String, dynamic>.
no setter
hashCode int
The hash code for this object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
source String
The JSON data source representation for this object.
final

Methods

decodeAsNullableObject<T>(JsonObjectNullableDecoder<T> decoder) → T
Returns the JSON data decoded as an instance of T extends Object.
decodeAsNullableObjectList<T>(JsonObjectNullableDecoder<T> decoder) List<T>
Returns the JSON data decoded as an instance of List<T extends Object>.
decodeAsObject<T>(JsonObjectDecoder<T> decoder) → T
Returns the JSON data decoded as an instance of T extends Object.
decodeAsObjectList<T>(JsonObjectDecoder<T> decoder) List<T>
Returns the JSON data decoded as an instance of List<T extends Object>.
decodeAsPrimitiveList<T>() List<T>
Returns the JSON data decoded as an instance of List<T>.
decodeAsPrimitiveValue<T>() → T
Returns the JSON data decoded as an instance of T.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override

Static Methods

encodeObject<T>(T value, {JsonObjectEncoder<T>? encoder, bool checkIfJsonable = true}) JsonString
Constructs a JsonString converting value into a valid JSON Object.
encodeObjectList<T>(List<T> list, {JsonObjectEncoder<T>? encoder, bool checkIfJsonable = true}) JsonString
Constructs a JsonString converting list into a valid JSON list.
encodePrimitiveList<T>(List<T> list) JsonString
Constructs a JsonString converting list into a valid JSON List.
encodePrimitiveValue<T>(T value) JsonString
Constructs a JsonString converting value into a valid JSON primitive value.
orNull(String source, {bool enableCache = false}) JsonString?
Constructs a JsonString if source is a valid JSON.