What difference between stateless and stateful widgets?

前端 未结 3 1287
借酒劲吻你
借酒劲吻你 2021-01-12 12:09

I am learning Dart/flutter and trying to understand how Widgets system works. But I can\'t understand what difference between stateless and stateful widgets? For example I h

3条回答
  •  -上瘾入骨i
    2021-01-12 12:31

    Check out the Flutter Interactivity Tutorial.

    If your widget's build method depends entirely on its immutable constructor arguments, you should use a StatelessWidget because they're simpler. If you want to store some persistent private data that you expect to mutate over time, use a StatefulWidget and store the data on the State.

提交回复
热议问题