Why would I ever use StatelessWidget over StatefulWidget?

108

You'll get a small performance gain using StatelessWidget. It's very negligible but it's there.

Outside of this, there are some architectural gains. A StatelessWidget is entirely immutable. This is important enough to justify using Stateless over Stateful when there's no need for a State.

Share:
108
Yousef Gamal
Author by

Yousef Gamal

Updated on December 08, 2022

Comments

  • Yousef Gamal
    Yousef Gamal over 1 year

    I know that StatefulWidget allows us to change widgets, while StatelessWidget does not.

    But if StatefulWidget can perform everything that StatelessWidget can perform + more, why would I ever use StatelessWidget over StatefulWidget?
    Is StatelessWidget better in anyways other than that it's easier to implement?