JsonObject class ast decoder encoder

JSON Object (Map) element.

Inheritance
Implementers

Constructors

JsonObject({required Map<String, JsonNode> data, String key = ""})
Construct a new JsonObject instance.
JsonObject.fromMap({required Map<String, dynamic> data, String key = ""})
Construct a new JsonObject using the specified key values of each JsonNode.
factory
JsonObject.fromNodes({required List<JsonNode> nodes, String key = ""})
Construct a new JsonObject using the specified key values of each JsonNode.
factory

Properties

annotations List<TypeAnnotation>
Metadata annotations which alter (de)serialization of this node.
finalinherited
data Map<String, JsonNode>
The JSON data of type T.
finalinherited
formattingOptions JsonFormattingOptions
Get JSON formatting options which returns standardJsonFormatting if not set.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
key String
The JSON key (tag name).
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stringify String
Convert to (standard) formatted JSON String.
no setteroverride

Methods

array<T>(String key, {T decodeFromJsonObject(JsonObject)?, Function? decoder, List? childType}) List<T>
Get List with child T by String key.
arrayNode<T>(String key, {T decodeFromJsonObject(JsonObject)?, Function? decoder, List? childType}) JsonArray<List<T>>
Get JsonArray by String key.
arrayNodeOrNull<T>(String key, {Function? decoder, List? childType}) JsonArray<List<T>>?
Get JsonArray or null by String key.
arrayOrNull<T>(String key, {Function? decoder, List? childType}) List<T>?
Get List with child T or null by String key.
boolean(String key) bool
Get bool by String key.
booleanNode(String key) JsonBoolean
Get JsonBoolean by String key.
booleanNodeOrNull(String key) JsonBoolean?
Get JsonBoolean or null by String key.
booleanOrNull(String key) bool?
Get bool or null by String key.
byKey(String key) JsonNode
Get JsonNode by String key.
float(String key) double
Get double by String key.
floatNode(String key) JsonFloatingNumber
Get JsonFloatingNumber by String key.
floatNodeOrNull(String key) JsonFloatingNumber?
Get JsonFloatingNumber or null by String key.
floatOrNull(String key) double?
Get double or null by String key.
getDataAsMap<R>() Map<String, R>
Return raw (unwrapped) object data as Map<String, R> where R is not of type JsonNode but a dart StandardType (String, bool, etc).
getDataAsTypedMap<T, R>({required T toTypedKey(String), R toTypedValue(dynamic)?}) Map<T, R>
Return raw (unwrapped) object data as Map<String, R> where R is not of type JsonNode but a dart StandardType (String, bool, etc).
hasKey(String key) bool
Returns true if JSON content contains key.
integer(String key) int
Get int by String key.
integerNode(String key) JsonIntegerNumber
Get JsonIntegerNumber by String key.
integerNodeOrNull(String key) JsonIntegerNumber?
Get JsonIntegerNumber or null by String key.
integerOrNull(String key) int?
Get int or null by String key.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
object<R>(String key) Map<String, R>
Get Map<String,R> by String key.
objectNode(String key) JsonObject
Get JsonObject by String key.
objectNodeOrNull(String key) JsonObject?
Get JsonObject or null by String key.
objectOrNull<R>(String key) Map<String, R>?
Get Map<String,R> by String key.
string(String key) String
Get String by String key.
stringifyWithFormatting(JsonFormattingOptions options) String
Convert to (custom) formatted JSON String.
stringNode(String key) JsonString
Get JsonString by String key.
stringNodeOrNull(String key) JsonString?
Get JsonString or null by String key.
stringOrNull(String key) String?
Get String or null by String key.
toString() String
A string representation of this object.
inherited
typedObject<T, R>({required String key, required T toTypedKey(String), R toTypedValue(dynamic)?}) Map<T, R>
Get Map<T,R> by String key.
typedObjectOrNull<T, R>({required String key, required T toTypedKey(String), R toTypedValue(dynamic)?}) Map<T, R>?
Get Map<T,R> by String key.

Operators

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

Static Methods

fromTypedMap<T>({required Map<T, dynamic> data, required String keyToString(T), String key = ""}) JsonObject
Construct a new JsonObject where each key is an enumerated value.