First of all I would like to say that I am new to Flutter.
I don't understand the difference between class and stateless widget. I understand why I'm using stateful , because of setState. but why should I use statless instead of just class ?
CodePudding user response:
Difference is actually depends on your application really but using class
is more preferable in most cases. They are same, for the performance part, if you will not call setState
in Widget
. There are other differences like testability and accuracy. I suggest you first watch official flutter tutorial before using which one to use.
Official tutorial