toJson method
Serializes the pivot record into a JSON-compatible map.
Includes the related user/role identifiers and timestamp metadata.
Example:
final json = pivot.toJson();
print(json['user_id']);
print(json['role_id']);
Implementation
@override
Map<String, dynamic> toJson() {
return {
"user_id" : userID,
"role_id" : roleID,
"createdAt": createdAt?.toIso8601String(),
"updatedAt": updatedAt?.toIso8601String()
};
}