Skip to content

fix: put back context.mounted check #558

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

IgorKhramtsov
Copy link

@IgorKhramtsov IgorKhramtsov commented Apr 23, 2025

Hi!

We see a small number of error reports caused by unmounted context at the time FToast.removeCustomToast is called.

Scenario

We have a Flutter app integrated into the native app and this is what happens:

  1. We show a toast
  2. User pops the page and the whole flutter app is closed (and thus the context is unmounted)
  3. FToast calls removeCustomToast on timer to close the toast that is shown
  4. _showOverlay is called that tries to get the Overlay, but the context is unmounted
  5. The error is thrown

The straightforward fix would be to just check whether the context is mounted and handle this edge case. However, I see that there is already code in place to do that, but it is commented out by this commit 5c1dd53

Do you have any context why it was commented out and whether it's still relevant?

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

Successfully merging this pull request may close these issues.

1 participant