3

I am studying Redux combining it with Flutter, and I have this question, does making stateful widgets make sense in Flutter if you follow redux architecture? I could think that for animations and little widgets it's better to make a stateful widget rather than a new attribute to the real appState, but I am not really sure... I need someone to clarify me this dummy question.

Raul Mabe
  • 453
  • 5
  • 15

2 Answers2

5

Redux is not even close to replacing StatefulWidget.

A simple example is animations. Each of them requires to store, dispose and interact with an AnimationController/Tweens.

Redux really is for a serializable state. Typically what comes from your API, which you may or may not want to store on the device.

StatefulWidget kicks in for everything else.

Randika Vishman
  • 7,983
  • 3
  • 57
  • 80
Rémi Rousselet
  • 256,336
  • 79
  • 519
  • 432
2

Definitely. Use stateful widget for rather short-lived UI state and Redux for longer-living state and state managed by business logic.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567