package Ġdev . eg gn stone . ch ime . ob servers Ċ Ċ import Ġcom . amazonaws . services . ch ime . sdk . meet ings . realtime . dat ame ssage . Data Message Ċ import Ġcom . amazonaws . services . ch ime . sdk . meet ings . realtime . dat ame ssage . Data Message Observer Ċ import Ġio . flutter . plugin . common . Event Channel . Event Sink Ċ import Ġorg . json . JSONObject Ċ Ċ class ĠCh ime Realtime Data Message Observer ( private Ġval Ġ_ event Sink : ĠEvent Sink ) Ġ: ĠData Message Observer Ċ { ĊĠĠĠ Ġprivate Ġfun Ġconvert Data Message ToJson ( data Message : ĠData Message ): ĠJSONObject ĊĠĠĠ Ġ{ ĊĠĠĠĠĠĠĠ Ġval ĠjsonObject Ġ= ĠJSONObject () ĊĊĠĠĠĠĠĠĠ ĠjsonObject . put (" Topic ", Ġdata Message . topic ) ĊĠĠĠĠĠĠĠ ĠjsonObject . put (" data ", ĠString ( data Message . data , ĠChar sets . UTF _ 8 )) ĊĊĠĠĠĠĠĠĠ Ġreturn ĠjsonObject ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Data Message Received ( data Message : ĠData Message ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval ĠjsonObject Ġ= ĠJSONObject () ĊĠĠĠĠĠĠĠ ĠjsonObject . put (" Name ", Ġ" Data Message Received ") ĊĠĠĠĠĠĠĠ ĠjsonObject . put (" Arguments ", Ġconvert Data Message ToJson ( data Message )) ĊĠĠĠĠĠĠĠ Ġ_ event Sink . success ( jsonObject . toString ()) ĠĠĠ Ġ} Ċ } Ċ