I am reading Flutter's official documentation on state management and in this page it says:
For example, in Flutter it’s okay to rebuild parts of your UI from scratch instead of modifying it. Flutter is fast enough to do that, even on every frame if needed.
As an Android developer, it is true in most cases that constructing a View
is expensive and should be avoided. So I am wondering why re-constructing view hierarchy is affordable in Flutter.
Comparing the class declarations of Android's View
and Flutter's Widget
, the Android View has much more fields and do a lot of works in the constructor, so I guess one reason is that creating a new class instance in Flutter is cheaper than that in Android. But why Android (as an imperative framework) needs such a complex View
class to drive the UI than Flutter (as a declarative framework)? What's the common difference between the UI rendering mechanisms of imperative UI and declarative UI?