toJson method

Map<String, Object?> toJson()

Converts the object into JSON map

Implementation

Map<String, Object?> toJson() {
  return switch (this) {
    Message() => (this as Message).toJson(),
    InaccessibleMessage() => (this as InaccessibleMessage).toJson(),
  };
}