flutter_pagewise
flutter_pagewise copied to clipboard
when ever the list loads its throws an error :setState() or markNeedsBuild() called during build.
In my project, I have used PagewiseLoadController and PagewiseListView.
════════ (2) Exception caught by foundation library ════════════════════════════════════════════════ setState() or markNeedsBuild() called during build.
Can you please share the code?
Same problem.
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()
Is the problem solved?