toMetaJson method

  1. @override
Map<String, dynamic> toMetaJson()
override

Serializes the pivot record into a metadata-oriented JSON map.

Includes the database id in addition to the relationship fields and timestamp metadata.

Example:

final meta = pivot.toMetaJson();
print(meta['id']);

Implementation

@override
Map<String, dynamic> toMetaJson() {
  return {
    "id": id,
    "user_id" : userID,
    "role_id" : roleID,
    "createdAt": createdAt?.toIso8601String(),
    "updatedAt": updatedAt?.toIso8601String()
  };
}