toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final Map<String, dynamic> data = Map<String, dynamic>();

  try {
    data['id'] = this.id;
    data['text'] = this.text;
    data['image'] = this.image;
    data['video'] = this.video;
    data['createdAt'] = this.createdAt.millisecondsSinceEpoch;
    data['user'] = user.toJson();
    data['quickReplies'] = quickReplies?.toJson();
    data['customProperties'] = this.customProperties;
  } catch (e, stack) {
    print('ERROR caught when trying to convert ChatMessage to JSON:');
    print(e);
    print(stack);
  }
  return data;
}