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 boolread-only - booleanValue → bool
-
Returns a bool or
false
if rawValue is not thruthyread-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 doubleread-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 intread-only - integerValue → int
-
Returns a int or 0 if rawValue is not a int
read-only
- jsonNull → Json
-
Create a Json with a
null
rawValueread-only -
list
→ List<
Json> ? -
Returns a List or
null
if rawValue is not a List Each element of the list is wrapped in aJson
instanceread-only - listObject → List?
-
Returns a List or
null
if rawValue is not a List Leaves list items untouchedread-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
instanceread-only -
map
→ Map<
String, Json> ? -
Returns a Map or
null
if rawValue is not a Map Each value of the map is wrapped in aJson
read-only -
mapObject
→ Map<
String, dynamic> ? -
Returns a Map or
null
if rawValue is not a Map Leaves map values untouchedread-only -
mapObjectValue
→ Map<
String, dynamic> -
Returns a Map of
T
or empty Map if rawValue is not a Map ofT
Leaves map values untouchedread-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 Stringread-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 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 non-existent 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 -
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
. Ifkey
does not exist, returns a empty Json instance with an exception
Constants
- decoder → const JsonDecoder