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 boolno setter - booleanValue → bool
-
Returns a bool or
false
if rawValue is not thruthyno 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 intno setter - integerValue → int
-
Returns a int or 0 if rawValue is not a int
no setter
- jsonNull → Json
-
Create a Json with a
null
rawValueno setter -
list
→ List<
Json> ? -
Returns a List or
null
if rawValue is not a List Each element of the list is wrapped in aJson
instanceno setter - listObject → List?
-
Returns a List or
null
if rawValue is not a List Leaves list items untouchedno 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
instanceno setter -
map
→ Map<
String, Json> ? -
Returns a Map or
null
if rawValue is not a Map Each value of the map is wrapped in aJson
no setter -
mapObject
→ Map<
String, dynamic> ? -
Returns a Map or
null
if rawValue is not a Map Leaves map values untouchedno setter -
mapObjectValue
→ Map<
String, dynamic> -
Returns a Map of
T
or empty Map if rawValue is not a Map ofT
Leaves map values untouchedno 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 Stringno 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 isnull
-
listOf<
T> ([T? builder(dynamic)?]) → List< T> ? -
Returns a List of
T
or empty list if rawValue is not a List ofT
If actual data is not a List ofT
, callsbuilder
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 ofT
If actual data is not a List ofT
, callsbuilder
to get one -
mapOf<
T> ([T? builder(dynamic)?]) → Map< String, T> ? -
Returns a Map of
T
ornull
if rawValue is not a Map ofT
If actual data is not a Map ofT
, callsbuilder
to get one -
mapOfValue<
T> () → Map< String, T> ? -
Returns a List of
T
or empty Map if rawValue is not a List ofT
If actual data is not a List ofT
, callsbuilder
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
ornull
if rawValue is not aT
If actual data is notT
, callsbuilder
to get one -
ofTypeValue<
T> (T defaultValue, [T? builder(dynamic)?]) → T -
Returns a
T
ordefaultValue
if rawValue is not aT
If actual data is notT
, callsbuilder
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
. Ifkey
does not exist, returns a empty Json instance with an exception
Constants
- decoder → const JsonDecoder