Json class abstract

A class that can be serialized to and from json.

Implementers

Constructors

Json()
Used for constructing a JsonObjectKey parser.
const
Json.parse(Map<String, dynamic> json, {bool strict = true})
Deserialize a json map

Properties

hashCode int
The hash code for this object.
no setterinherited
keys List<JsonKey>
Define all JsonKeys that this class uses.
no setter
props List<Object?>
Used for Equatable comparison and string representation.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parse(Map<String, dynamic> json, {bool strict = true}) → void
Parse a json map into this object. If strict is true, then an exception will be thrown if the json map does not contain a key that this object expects.
toJson() Map<String, dynamic>
Serialize this object to json.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

boolean(String key) JsonBoolean
A JsonKey that parses a boolean.
booleanList(String key) JsonBooleanList
A JsonKey that parses a list of booleans.
booleanMap(String key) JsonBooleanMap
A JsonKey that parses a map of booleans.
double(String key) JsonDouble
A JsonKey that parses a double.
doubleList(String key) JsonDoubleList
A JsonKey that parses a list of doubles.
doubleMap(String key) JsonDoubleMap
A JsonKey that parses a map of doubles.
int(String key) JsonInt
A JsonKey that parses an int.
intList(String key) JsonIntList
A JsonKey that parses a list of ints.
intMap(String key) JsonIntMap
A JsonKey that parses a map of ints.
object<T extends Json>(String key, T parser()) JsonObjectKey<T>
A JsonKey that parses a Json object.
objectList<T extends Json>(String key, T parserConstructor()) JsonObjectKeyList<T>
A JsonKey that parses a list of Json objects.
objectMap<T extends Json>(String key, T parserConstructor()) JsonObjectKeyMap<T>
A JsonKey that parses a map of Json objects.
polymorphic<T extends JsonPolymorphic<T>>(String key, List<T Function()> parsers) JsonPolymorphicKey<T>
A JsonKey that parses a JsonPolymorphic object.
polymorphicList<T extends JsonPolymorphic<T>>(String key, T parse(Map<String, dynamic>)) JsonPolymorphicKeyList<T>
A JsonKey that parses a list of JsonPolymorphic objects.
polymorphicMap<T extends JsonPolymorphic<T>>(String key, T parse(Map<String, dynamic>)) JsonPolymorphicKeyMap<T>
A JsonKey that parses a map of JsonPolymorphic objects.
string(String key) JsonString
A JsonKey that parses a string.
stringList(String key) JsonStringList
A JsonKey that parses a list of strings.
stringMap(String key) JsonStringMap
A JsonKey that parses a map of strings.