how do i use the setstate function in the stateless widget class?

Sure you can’t use setState() in StatelessWidget, that’s the idea of this widget. StatelessWidget should be used only for “dumb” views that shouldn’t hold any state. If you should set any state to your widget, consider to use StatefulWidget.

Take a look on official flutter documentation: https://api.flutter.dev/flutter/widgets/StatelessWidget-class.html

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top