jaumard / sms_autofill

Flutter plugin to provide SMS code autofill support
MIT License
281 stars 173 forks source link

unregisterListener doesnt seem to work and unregister the listeners #158

Open vigdora opened 2 years ago

vigdora commented 2 years ago

cosider this code snippet: image

I am expecting all listeners to be unregistered every time I am closing the view related to this controller.. BUT I tested it and it actually accumulates the listeners every time I am routing back to the view. and after receiving the sms - the app crashes due to an error. I highly suspect unregisterListener() doesn't really do its job. and I saw some other issue in this topic in.... may be someone can validate it does work? or may be I am doing something wrong?

vigdora commented 2 years ago

after some investigation, I realized I have forgot to cancel the subscription so I added line 43 and it worked: image

I feel like the documentation wasn't clear about it...