toJson method

Map<String, dynamic> toJson()

Converts this model to a full JSON-compatible map, including metadata.

Implementation

Map<String, dynamic> toJson() {
  return {
    primaryKeyColumn: id,
    ...toMap(),
    if (timestamps && createdAt != null) 'created_at': createdAt!.toIso8601String(),
    if (timestamps && updatedAt != null) 'updated_at': updatedAt!.toIso8601String(),
  };
}