koukibadr / Cherry-Toast

https://pub.dev/packages/cherry_toast
MIT License
21 stars 14 forks source link

this widget has been unmounted, so the State no longer has a context (and should be considered defunct) #34

Open suhaib-raadan opened 1 year ago

suhaib-raadan commented 1 year ago

why this happen sometimes in my app

koukibadr commented 1 year ago

Hello @suhaib-raadan can you share more details ? (code example, screenshots...)

alihassan143 commented 1 year ago

@suhaib-raadan you are calling toast when the actual context of the widget is no longer mounted you can use condition like

if(context.mounted){
// show toast 
}
shuzibanshou commented 1 year ago

@suhaib-raadan you are calling toast when the actual context of the widget is no longer mounted you can use condition like

if(context.mounted){
// show toast 
}

Yeah, I found this issue as well, when the toast widget auto dismiss if you click the widget it will report this error, but it don't appear everytime

should modify the 333 line of 《cherry_toast.dart》 if(mounted){ Navigator.maybePop(context); }

koukibadr commented 1 year ago

Checkout the new version 1.2.1 contains the bug fix https://pub.dev/packages/cherry_toast