JsonPayload class
A mutable Json payload that enforce it'll always be able to json encode it's content
Constructors
- JsonPayload()
- JsonPayload.from(Json other, {bool initial = true})
- JsonPayload.fromDynamic(dynamic rawValue, {bool initial = true})
- JsonPayload.fromList(List list, {bool initial = true})
-
JsonPayload.fromMap(Map<
String, dynamic> map, {bool initial = true}) - JsonPayload.fromString(String json)
Properties
- boolean → bool?
-
Returns a bool or
null
if rawValue is not a boolno setterinherited - booleanValue → bool
-
Returns a bool or
false
if rawValue is not thruthyno setterinherited - exception ↔ JsonException?
-
Exceptions are never thrown, instead they are silently stored in the Json instance
getter/setter pairinherited
- float → double?
-
no setterinherited
- floatValue → double
-
Returns a double 0 if rawValue is not a double
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- integer → int?
-
Returns a int or
null
if rawValue is not a intno setterinherited - integerValue → int
-
Returns a int or 0 if rawValue is not a int
no setterinherited
- jsonNull → JsonPayload
-
Create a Json with a
null
rawValueno setteroverride -
list
→ List<
JsonPayload> ? -
Returns a List or
null
if rawValue is not a List Each element of the list is wrapped in a Json instanceno setteroverride - listObject → List?
-
Returns a List or
null
if rawValue is not a List Leaves list items untouchedno setterinherited - listObjectValue → List
-
Returns a List or an empty List if rawValue is not a List
Leaves list items untouched
no setterinherited
-
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
no setteroverride
-
map
→ Map<
String, JsonPayload> ? -
Returns a Map or
null
if rawValue is not a Map Each value of the map is wrapped in a Jsonno setteroverride -
mapObject
→ Map<
String, dynamic> ? -
Returns a Map or
null
if rawValue is not a Map Leaves map values untouchedno setterinherited -
mapObjectValue
→ Map<
String, dynamic> -
Returns a Map of
T
or empty Map if rawValue is not a Map ofT
Leaves map values untouchedno setterinherited -
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
no setteroverride
- rawValue ↔ dynamic
-
Actual value
getter/setter pairinherited-getter
- 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 setterinherited - stringValue → String
-
Returns a String or an empty String if rawValue is not a String
no setterinherited
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 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 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
-
toJson(
) → dynamic -
inherited
-
toString(
) → String -
Returns actual Json
inherited
Operators
-
operator ==(
Object other) → bool -
Compare Json by instance or by value
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