Json class Null safety

Wraps Json decoded data

Implementers

Constructors

Json()
Empty Json
Json.from(Json other)
Create Json from another
Json.fromDynamic(dynamic _rawValue)
Create a Json instance from any value
Json.fromList(List list)
Create Json from a List
Json.fromMap(Map<String, dynamic> map)
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
read-only
booleanValue bool
Returns a bool or false if rawValue is not thruthy
read-only
exception JsonException?
Exceptions are never thrown, instead they are silently stored in the Json instance
read / write
float double?
Returns a double or null if rawValue is not a double
read-only
floatValue double
Returns a double 0 if rawValue is not a double
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
integer int?
Returns a int or null if rawValue is not a int
read-only
integerValue int
Returns a int or 0 if rawValue is not a int
read-only
jsonNull Json
Create a Json with a null rawValue
read-only
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
read-only
listObject List?
Returns a List or null if rawValue is not a List Leaves list items untouched
read-only
listObjectValue List
Returns a List or an empty List if rawValue is not a List Leaves list items untouched
read-only
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
read-only
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
read-only
mapObject Map<String, dynamic>?
Returns a Map or null if rawValue is not a Map Leaves map values untouched
read-only
mapObjectValue Map<String, dynamic>
Returns a Map of T or empty Map if rawValue is not a Map of T Leaves map values untouched
read-only
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
read-only
rawValue → dynamic
Actual value
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
string String?
Returns a String or null if rawValue is not a String
read-only
stringValue String
Returns a String or an empty String if rawValue is not a String
read-only

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 non-existent 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
toString() String
Returns actual Json
override

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited
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