package Ġtech . block man ic . flutter _ t emi Ċ Ċ import Ġcom . robot emi . sdk . Battery Data Ċ import Ġcom . robot emi . sdk . listeners . On Battery Status Changed Listener Ċ import Ġio . flutter . plugin . common . Event Channel Ċ Ċ class ĠOn Battery Status Changed Listener Impl : ĠOn Battery Status Changed Listener , ĠEvent Channel . Stream Handler Ġ{ ĊĠĠĠ Ġprivate Ġvar Ġevent Sink : ĠEvent Channel . Event Sink ? Ġ= Ġnull ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġconst Ġval ĠST REAM _ CHANNEL _ NAME Ġ= Ġ" flutter _ t emi / on _ battery _ status _ changed _ stream " ĊĠĠĠĠĠĠĠ Ġfun Ġbattery ToMap ( battery Data : ĠB attery Data ): ĠHashMap < String , ĠAny > Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġbattery Map Ġ= ĠHashMap < String , ĠAny >( 2 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġbattery Map [" level "] Ġ= Ġbattery Data . level ĊĠĠĠĠĠĠĠĠĠĠĠ Ġbattery Map [" is Ch arging "] Ġ= Ġbattery Data . is Ch arging ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġbattery Map ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Battery Status Changed ( battery Data : ĠB attery Data ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġif ( battery Data Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠ Ġevent Sink ?. success ( battery ToMap ( battery Data )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Listen ( arguments : ĠAny ?, Ġevent Sink : ĠEvent Channel . Event Sink ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . event Sink Ġ= Ġevent Sink ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Cancel ( p 0 : ĠAny ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . event Sink Ġ= Ġnull ĊĠĠĠ Ġ} Ċ Ċ }