Flutter Interview Question-State management


Why state management is required in flutter and explain reasons?

  1. Better App Maintenance: In flutter state management is required in the bigger apps. The problem is that in bigger apps where we have a lot of widgets. In that case, if we are planning to add new widget then it will be difficult to maintain app. other issue is when some child widget needs some data, we typically need to pass data through constructors or widgets arguments, this can lead to very long chains and going forward very difficult to manage.
  2. To solve Performance Issues: one more issue is performance because if we manage everything in the one file and tour main widget or in a couple of root widgets, then these widgets rebuild whenever anything and that data changes and therefore the entire widget tree rebuilds even if only one small child widget somewhere is interested in the updated data.