Map<String, dynamic> eventToJson<T extends RawEvent>(Map<String, dynamic> json, T event) { json["type"] = event.type.toString(); return json; }