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

when ever the list loads its throws an error :setState() or markNeedsBuild() called during build. #79

Open
sudip92 opened this issue Oct 2, 2019 · 4 comments

Comments

@sudip92
Copy link

sudip92 commented Oct 2, 2019

In my project, I have used PagewiseLoadController and PagewiseListView.

════════ (2) Exception caught by foundation library ════════════════════════════════════════════════
setState() or markNeedsBuild() called during build.

@webrndexperts
Copy link

Can you please share the code?

@oxydron
Copy link

oxydron commented Nov 28, 2019

Same problem.

@luckv
Copy link

luckv commented Apr 3, 2020

Probably you are trying to call setState() in the callback passed as listener of PagewiseLoadController.
You can do:

 WidgetsBinding.instance.addPostFrameCallback((_) {
        if (mounted)
          setState(() {
            //Modify your state
          });
      });

This happens because the callback is called when the child is drawing when the parent calls setState()

@wyxcoder
Copy link

Is the problem solved?

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

5 participants