package Ġcom . mar lok ess ler . shared preferences Ċ Ċ import Ġandroid . content . Context Ċ import Ġio . flutter . embedding . engine . plugins . Flutter Plugin Ċ import Ġio . flutter . embedding . engine . plugins . Flutter Plugin . Flutter Plugin Binding Ċ import Ġio . flutter . plugin . common . Binary Messenger Ċ import Ġio . flutter . plugin . common . Method Channel Ċ import Ġio . flutter . plugin . common . Plugin Registry . Registrar ĊĊĊ Ċ /** ĠSharedPreferences Plugin Ġ Ġ*/ Ċ class ĠShared preferences Plugin Ġ: ĠFlutter Plugin Ġ{ ĊĊĠ Ġprivate Ġvar Ġchannel : ĠMethod Channel ? Ġ= Ġnull ĊĊĊĊĠ Ġcompanion Ġobject Ġ{ ĊĊĠĠĠ Ġprivate Ġconst Ġval ĠCHAN NEL _ NAME Ġ= Ġ" com . mar lok ess ler . shared preferences " ĊĊĠĠĠ Ġfun Ġregister With ( regist rar : ĠRegist rar ) Ġ{ ĊĠĠĠĠĠ Ġval Ġplugin Ġ= ĠShared preferences Plugin () ĊĠĠĠĠĠ Ġplugin . setup Channel ( regist rar . messenger (), Ġregist rar . context ()) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĊĊĠ Ġoverride Ġfun Ġon Attached To Engine ( binding : ĠFlutter Plugin Binding ) Ġ{ ĊĠĠĠ Ġsetup Channel ( binding . flutter Engine . dart Executor , Ġbinding . application Context ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġon Detached From Engine ( binding : ĠFlutter Plugin Binding ) Ġ{ ĊĠĠĠ Ġteardown Channel () ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġsetup Channel ( messenger : ĠBinary Messenger , Ġcontext : ĠContext ) Ġ{ ĊĠĠĠ Ġchannel Ġ= ĠMethod Channel ( messenger , ĠCHAN NEL _ NAME ) ĊĠĠĠ Ġval Ġhandler Ġ= ĠMethod Call Handler SharedPreferences ( context ) ĊĠĠĠ Ġchannel !!. set MethodCall Handler ( handler ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġteardown Channel () Ġ{ ĊĠĠĠ Ġchannel !!. set MethodCall Handler ( null ) ĊĠĠĠ Ġchannel Ġ= Ġnull ĊĠ Ġ} Ċ } ĊĊĊ