ServiceReply.fromJson constructor
Creates a ServiceReply with the information stored in the json
.
Throws a JsonMissingKeyException if there is missing one of the needed
keys (BrokerKeys.identifier
, BrokerKeys.receivers
,BrokerKeys.sender
,
BrokerKeys.serviceType
) in the json
.
Throws a InvalidJsonSchemaException if some values
doesn't match the expected value type.
Implementation
factory ServiceReply.fromJson(Map<String, dynamic> json) {
try {
final ServiceReply msg = ServiceReply()
..generateFromJson(json)
..results = json.containsKey(BrokerKeys.results)
? json[BrokerKeys.results] as Map<String, dynamic>
: null;
return msg;
} on TypeError catch (e) {
throw InvalidJsonSchemaException(
e.stackTrace.toString(), json.toString());
}
}