toJson method
Convert the interaction event to a JSON map
Implementation
Map<String, dynamic> toJson() {
return {
'widgetId': widgetId,
'type': type.toString().split('.').last,
'value': value,
'timestamp': timestamp.toIso8601String(),
};
}