toJson method
Converts the message to a JSON map.
Implementation
Map<String, dynamic> toJson() {
try {
final Map<String, dynamic> data = {};
data["type"] = type;
data["from"] = from;
data["createdTime"] = createdTime;
data["expiresTime"] = expiresTime;
data["body"] = {
"initiator": initiator.toJson(),
"context": context.toJson(),
};
return data;
} catch (e) {
rethrow;
}
}