Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Flutter stateless and stateful widget question

I just wanna ask few questions

  1. Should i wrap my normal widget with stateless or stateful when using?
  2. What is the different of using it as is?

I just wanna build re usable widget and wondering if i should wrap it before re using!
Thanks for answering

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Use StatelessWidget if your widget will not change value. For example: you want to display a Container with color red and it is not going to change colour.

Use StatefulWidget if your widget will change value. For example: you want to display a number 10, and this number will be increased to 11 or decreased to 9 by pressing a button.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading