flutter_pagewise icon indicating copy to clipboard operation
flutter_pagewise copied to clipboard

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

Open sudip92 opened this issue 6 years ago • 4 comments

In my project, I have used PagewiseLoadController and PagewiseListView.

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

sudip92 avatar Oct 02 '19 12:10 sudip92

Can you please share the code?

webrndexperts avatar Oct 19 '19 07:10 webrndexperts

Same problem.

oxydron avatar Nov 28 '19 14:11 oxydron

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()

luckv avatar Apr 03 '20 16:04 luckv

Is the problem solved?

wyxcoder avatar Jan 11 '21 19:01 wyxcoder