toJson method

String toJson()

Implementation

String toJson() {
  return json.encode({
    "class": "Message",
    "role": EnumToString.convertToString(role),
    "content": content,
    "images": images?.length ?? 0,
    "timestamp": timestamp.toIso8601String(),
  });
}