To @mihalycsaba
I will work on simple example; starting with Counter I guess. It is good enough.
My idea and work are not like to any exiting statement so I cannot point out which one is comparable to mine. You can refer to my explanation below.
To @gawi151
Yes, it is the tree-layout structure that I propose for managing all components in projects. You point it out correctly. At the beginning, I had looked at the Flutter tree (ProxyWidget for particularly); and tried to integrated it with my concept but they does not work along well.
In general, as said in my documentation, despite of different available approaches (bloc, get_it, provider, InheritedWidget, …), they all follow one idea: lifting the state up (Flutter suggest it). We will have Observables and multiple UIs subscribe to them and update their state (or rebuilding UI) whenever their Observables change.
My approach is against it - there would be no such kind of Observable. Instead, all components are observables, subscribed by its direct parents. For example, a Toggle is an observable; which is subscribed by the parents using it, such as a HomeScreen. When toggle’s state changes, HomeScreen will react accordingly - trigger the callBack. When needed, HomeScreen is also the object who “commands” the Toggle to update its state as well.
It also applies same thing to other components that is not UI as well: Data providers, Repositories, … They will be attached into the tree; they have state just like UIs and obey same communication rules.
At first, I did love Provider, get_it, then Bloc. They provide convenient ways to manage app state. But when the app started to scale up; features by features. The ‘lifting the state up’ exposed many weakness: harder to debug, the widgets expand too much because of subscribing to many Observables, limit the flexibility of allocating logic, … I can’t show you all exactly details for each weakness because to do that, I need to reproduce the whole projects to demonstrate the issue details; and that projects will be at least five times bigger than the example and it will violate the confidential policy.
My approach has weaknesses too. It is more imperative, which is currently considered not good as declarative. It requires we have to implicitly update UIs. And worse, we have to inject the data deep down to lower components one by one. But actually after testing by applying my approach to the reproduced similar projects, those inconveniences were not bad as I think; and they are worthy because the existing issues were resolve by root. Again, I cannot show you the details so all of these are very subjective. All my work of this package has been resulted from my real experience.
Because at the moment my package is very discouraged to learn, I can only suggest that you just keep the mentioned concept and idea in mind for now (ignore the paper implementation). When you work with your projects and sometimes meet any drawbacks, confusing and frustration, maybe try to picture what if you apply the concept into the projects. If somehow it makes sense you can comeback and read more my package. If not, you are in correct direction
.
Bottomline, go for what you are confident with and have experience with.