skip to Main Content

I am passing anonymous function with Navigator.pushNamed in its body, but it is showing the error – setState() or markNeedsBuild() called during build – Flutter

This is the block of code causing error, if I remove Navigator.pushNamed from the function, no error occurs RoundedButton(buttonColor: Colors.lightBlueAccent,buttonText: 'Log In', onPress: (){Navigator.pushNamed(context, LoginScreen.id);}, <-- This line is causing error ), This is the code for RoundedButton class RoundedButton…

VIEW QUESTION
Back To Top
Search