toJson method
Serializes the pivot record into a JSON-compatible map.
Includes timestamp metadata but not the primary key.
Example:
final json = pivot.toJson();
print(json['created_at']);
print(json['updated_at']);
Implementation
Map<String, dynamic> toJson() {
return {"created_at": createdAt, "updated_at": updatedAt};
}