Skip to content

Fix: Remove unused setState causing error after widget disposal #24

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

eliasteeny
Copy link

Description

This PR removes unnecessary setState call from InfoPopupWidget that can trigger runtime errors after the widget has been disposed.

Problem

When navigating back while a popup is still visible, the following assertion error is thrown:

'package:flutter/src/widgets/framework.dart': Failed assertion: line 5148 pos 12: '_lifecycleState != _ElementLifecycle.defunct': is not true.

This occurs because setState is being called after the widget has been disposed.

Steps to Reproduce

  1. Run the example app.
  2. Open the "List Example."
  3. Tap any info icon to show a popup.
  4. While the popup is displayed, navigate back.
  5. Observe the console for the assertion error.

Proposed Solution

Removed the setState call that is invoked after the widget may have already been disposed. Based on testing, this change does not impact the functionality of the widget.

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