Json class

Wraps Json decoded data

Implementers

Constructors

Json()
Empty Json
Json.from(Json other, {bool initial = true})
Create Json from another
Json.fromDynamic(dynamic _rawValue, {bool initial = true})
Create a Json instance from any value
Json.fromList(List list, {bool initial = true})
Create Json from a List
Json.fromMap(Map<String, dynamic> map, {bool initial = true})
Create Json from a Map
Json.fromString(String json)
Decodes the string with JsonDecoder and wraps it with Json

Properties

boolean bool?
Returns a bool or null if rawValue is not a bool
no setter
booleanValue bool
Returns a bool or false if rawValue is not thruthy
no setter
exception JsonException?
Exceptions are never thrown, instead they are silently stored in the Json instance
getter/setter pair
float double?
no setter
floatValue double
Returns a double 0 if rawValue is not a double
no setter
hashCode int
The hash code for this object.
no setteroverride
integer int?
Returns a int or null if rawValue is not a int
no setter
integerValue int
Returns a int or 0 if rawValue is not a int
no setter
jsonNull Json
Create a Json with a null rawValue
no setter
list List<Json>?
Returns a List or null if rawValue is not a List Each element of the list is wrapped in a Json instance
no setter
listObject List?
Returns a List or null if rawValue is not a List Leaves list items untouched
no setter
listObjectValue List
Returns a List or an empty List if rawValue is not a List Leaves list items untouched
no setter
listValue List<Json>
Returns a List or an empty List if rawValue is not a List Each element of the list is wrapped in a Json instance
no setter
map Map<String, Json>?
Returns a Map or null if rawValue is not a Map Each value of the map is wrapped in a Json
no setter
mapObject Map<String, dynamic>?
Returns a Map or null if rawValue is not a Map Leaves map values untouched
no setter
mapObjectValue Map<String, dynamic>
Returns a Map of T or empty Map if rawValue is not a Map of T Leaves map values untouched
no setter
mapValue Map<String, Json>
Returns a Map or an empty Map if rawValue is not a Map Each value of the map is wrapped in a Json
no setter
rawValue → dynamic
Actual value
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
string String?
Returns a String or null if rawValue is not a String
no setter
stringValue String
Returns a String or an empty String if rawValue is not a String
no setter

Methods

exists([dynamic key]) bool
Returns true if exception is null
listOf<T>([T? builder(dynamic)?]) List<T>?
Returns a List of T or empty list if rawValue is not a List of T If actual data is not a List of T, calls builder to get one
listOfValue<T>([T? builder(dynamic)?]) List<T>
Returns a List of T or an empty List if rawValue is not a List of T If actual data is not a List of T, calls builder to get one
mapOf<T>([T? builder(dynamic)?]) Map<String, T>?
Returns a Map of T or null if rawValue is not a Map of T If actual data is not a Map of T, calls builder to get one
mapOfValue<T>() Map<String, T>?
Returns a List of T or empty Map if rawValue is not a List of T If actual data is not a List of T, calls builder to get one
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
ofType<T>([T? builder(dynamic)?]) → T?
Returns a T or null if rawValue is not a T If actual data is not T, calls builder to get one
ofTypeValue<T>(T defaultValue, [T? builder(dynamic)?]) → T
Returns a T or defaultValue if rawValue is not a T If actual data is not T, calls builder to get one
toJson() → dynamic
toString() String
Returns actual Json
override

Operators

operator ==(Object other) bool
Compare Json by instance or by value
override
operator [](dynamic key) Json
Returns a Json wrapping the data under key. If key does not exist, returns a empty Json instance with an exception

Constants

decoder → const JsonDecoder