Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
suhaib-raadan opened this issue Feb 20, 2023 · 4 comments
Assignees

Comments

@suhaib-raadan
Copy link

why this happen sometimes in my app

@suhaib-raadan suhaib-raadan changed the title flutter error: This widget has been unmounted, so the State no longer has a context (and should be considered defunct) this widget has been unmounted, so the State no longer has a context (and should be considered defunct) Feb 20, 2023
@koukibadr
Copy link
Owner

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

@alihassan143
Copy link
Contributor

@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
Copy link

shuzibanshou commented Apr 27, 2023

@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
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants