But, Flutter and React work the same way where UI is a function of state. In fact, Flutter started off imperatively but after React was released, they changed it to be declarative, and now Android via Jetpack Compose is changing to be declarative, all on the same general principle. I also use packages like flutter_hooks or ReArch which make encapsulating state much easier, I couldn't stand using initState and not forgetting to dispose for each piece of functionality.