JsonPayload class Null safety
A mutable Json payload that enforce it'll always be able to json encode it's content
Constructors
- JsonPayload()
- JsonPayload.from(Json other)
- JsonPayload.fromDynamic(dynamic rawValue)
- JsonPayload.fromList(List list)
-
JsonPayload.fromMap(Map<
String, dynamic> map) - JsonPayload.fromString(String json)
Properties
- boolean → bool?
-
Returns a bool or
null
if rawValue is not a boolread-only, inherited - booleanValue → bool
-
Returns a bool or
false
if rawValue is not thruthyread-only, inherited - exception ↔ JsonException?
-
Exceptions are never thrown, instead they are silently stored in the Json instance
read / write, inherited
- float → double?
-
Returns a double or
null
if rawValue is not a doubleread-only, inherited - floatValue → double
-
Returns a double 0 if rawValue is not a double
read-only, inherited
- 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, inherited - integerValue → int
-
Returns a int or 0 if rawValue is not a int
read-only, inherited
- jsonNull → JsonPayload
-
Create a Json with a
null
rawValueread-only, override -
list
→ List<
JsonPayload> ? -
Returns a List or
null
if rawValue is not a List Each element of the list is wrapped in a Json instanceread-only, override - listObject → List?
-
Returns a List or
null
if rawValue is not a List Leaves list items untouchedread-only, inherited - listObjectValue → List
-
Returns a List or an empty List if rawValue is not a List
Leaves list items untouched
read-only, inherited
-
listValue
→ List<
JsonPayload> -
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, override
-
map
→ Map<
String, JsonPayload> ? -
Returns a Map or
null
if rawValue is not a Map Each value of the map is wrapped in a Jsonread-only, override -
mapObject
→ Map<
String, dynamic> ? -
Returns a Map or
null
if rawValue is not a Map Leaves map values untouchedread-only, inherited -
mapObjectValue
→ Map<
String, dynamic> -
Returns a Map of
T
or empty Map if rawValue is not a Map ofT
Leaves map values untouchedread-only, inherited -
mapValue
→ Map<
String, JsonPayload> -
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, override
- rawValue ↔ dynamic
-
Actual value
read / write, inherited-getter
- 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, inherited - stringValue → String
-
Returns a String or an empty String if rawValue is not a String
read-only, inherited
Methods
-
exists(
[dynamic key]) → bool -
Returns
true
if exception isnull
inherited -
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 oneinherited -
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 oneinherited -
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 oneinherited -
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 oneinherited -
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 oneinherited -
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 oneinherited -
removeElementWithKey(
dynamic key) → void -
Remove element under
key
-
toString(
) → String -
Returns actual Json
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited
-
operator [](
dynamic key) → JsonPayload -
Returns a Json wrapping the data under
key
. Ifkey
does not exist, returns a empty Json instance with an exceptionoverride -
operator []=(
dynamic key, dynamic value) → void