package Ġcom . example . flutter _ plugin _ alert Ċ Ċ import Ġandroidx . annotation . NonNull Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . app . Activity Ċ import Ġandroid . widget . Toast Ċ import Ġio . flutter . embedding . engine . plugins . Flutter Plugin Ċ import Ġio . flutter . plugin . common . MethodCall Ċ import Ġio . flutter . plugin . common . Method Channel Ċ import Ġio . flutter . plugin . common . Method Channel . MethodCall Handler Ċ import Ġio . flutter . plugin . common . Method Channel . Result Ċ import Ġio . flutter . plugin . common . Plugin Registry . Registrar Ċ import Ġio . flutter . embedding . engine . plugins . activity . Activity Aware Ċ import Ġio . flutter . embedding . engine . plugins . activity . Activity Plugin Binding Ċ Ċ /** ĠFlutter Plugin Alert Plugin Ġ*/ Ċ class ĠFlutter Plugin Alert Plugin : ĠFlutter Plugin , ĠMethod Call Handler , ĠActivity Aware Ġ Ġ{ ĊĠ Ġ/// ĠThe ĠMethod Channel Ġthat Ġwill Ġthe Ġcommunication Ġbetween ĠFlutter Ġand Ġnative ĠAndroid ĊĠ Ġ/// ĊĠ Ġ/// ĠThis Ġlocal Ġreference Ġserves Ġto Ġregister Ġthe Ġplugin Ġwith Ġthe ĠFlutter ĠEngine Ġand Ġunregister Ġit ĊĠ Ġ/// Ġwhen Ġthe ĠFlutter ĠEngine Ġis Ġdet ached Ġfrom Ġthe ĠActivity ĊĠ Ġprivate Ġlateinit Ġvar Ġchannel Ġ: ĠMethod Channel ĊĊĠ Ġprivate Ġlateinit Ġvar Ġcontext : ĠContext ĊĠ Ġprivate Ġlateinit Ġvar Ġactivity : ĠActivity ĊĊĠ Ġoverride Ġfun Ġon Attached To Engine (@ NonNull Ġflutter Plugin Binding : ĠFlutter Plugin . Flutter Plugin Binding ) Ġ{ ĊĠĠĠ Ġchannel Ġ= ĠMethod Channel ( flutter Plugin Binding . binary Messenger , Ġ" flutter _ plugin _ alert ") ĊĠĠĠ Ġchannel . set MethodCall Handler ( this ) ĊĊĠĠĠ Ġthis . context Ġ= Ġflutter Plugin Binding . application Context ĊĠ Ġ} ĊĊĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠ Ġ@ Jvm Static ĊĠĠĠ Ġfun Ġregister With ( regist rar : ĠRegist rar ) Ġ{ ĊĠĠĠĠĠ Ġval Ġchannel Ġ= ĠMethod Channel ( regist rar . messenger (), Ġ" flutter _ plugin _ alert ") ĊĠĠĠĠĠ Ġchannel . set MethodCall Handler ( Flutter Plugin Alert Plugin ()) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġon MethodCall (@ NonNull Ġcall : ĠMethod Call , Ġ@ NonNull Ġresult : ĠResult ) Ġ{ ĊĠĠĠ Ġif Ġ( call . method Ġ== Ġ" get Platform Version ") Ġ{ ĊĠĠĠĠĠ Ġresult . success (" Android Ġ${ android . os . Build . VERSION . RELEASE }") ĊĠĠĠ Ġ} ĊĠĠĠ Ġelse Ġif ( call . method Ġ== Ġ" show Toast ") ĊĠĠĠ Ġ{ ĊĠĠĠĠĠ Ġvar Ġdata Ġ= Ġcall . arguments () Ġas ĠHashMap < String , ĠAny > ĊĊĠĠĠĠĠ ĠToast . makeText ( context , data [' msg '], Toast . LENGTH _ SHORT ). show () ĊĠĠĠ Ġ} ĊĠĠĠ Ġelse Ġ{ ĊĠĠĠĠĠ Ġresult . not Implemented () ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġon Detached From Activity () Ġ{ ĊĠĠĠ ĠTODO (" Not Ġyet Ġimplemented ") Ċ } Ċ Ċ override Ġfun Ġon Re attached To Activity For Config Changes ( binding : ĠActivity Plugin Binding ) Ġ{ ĊĠĠĠ ĠTODO (" Not Ġyet Ġimplemented ") Ċ } Ċ Ċ override Ġfun Ġon Attached To Activity ( binding : ĠActivity Plugin Binding ) Ġ{ ĊĠĠĠ Ġactivity Ġ= Ġbinding . activity ; Ċ } Ċ Ċ override Ġfun Ġon Detached From Activity For Config Changes () Ġ{ ĊĠĠĠ ĠTODO (" Not Ġyet Ġimplemented ") Ċ } ĊĊĠ Ġoverride Ġfun Ġon Detached From Engine (@ NonNull Ġbinding : ĠFlutter Plugin . Flutter Plugin Binding ) Ġ{ ĊĠĠĠ Ġchannel . set MethodCall Handler ( null ) ĊĠ Ġ} Ċ } Ċ