toJSON method

Map<String, dynamic> toJSON()

Converts this MessageEnvelop to a JSON string. The message payload is passed as string Returns A JSON encoded representation is this object.

Implementation

Map<String, dynamic> toJSON() {
  var payload = message != null ? message.toString() : null;
  var json = {
    'message_id': message_id,
    'correlation_id': correlation_id,
    'message_type': message_type,
    'sent_time': StringConverter.toString2(sent_time ?? DateTime.now()),
    'message': payload
  };
  return json;
}