aloisdeniel / fountain

The modular state management solution for flutter.
MIT License
45 stars 2 forks source link

Provide a more complex example #1

Open irvine5k opened 3 years ago

irvine5k commented 3 years ago

I was from the time of Scoped Model, so I tried a lot of approaches of state management and I can say that Fountain is really interesting, and by the docs and visual identity, I can see that you put your heart into it. Nice job!

I liked the idea of separate actions instead of a class that handles all of them. The state injection in the widget tree is really easy, and since it's a global state, we can eliminate duplicated code(Providers everywhere). You brought the redux idea of middlewares, which is really useful to automate some boilerplate stuff like Analytics, Logging, Mock.

I only miss a more complex example that can better explain how the global state is built and the view listens only to one part of it.

aloisdeniel commented 3 years ago

Thanks a lot for your comment!

Sure, I will add a real world example soon!

If you have any suggestions for features that may be complex to implement, to test the edge cases, don't hesitate!

irvine5k commented 3 years ago

I have some suggestions: Authentication, Deep Link(Create or Feed State by URL information), Dependency Injection(Can be done by Middlewares?), Wizard/Stepper, Offline Persistence.

But there's one case that's used by many big companies and it's really unexplored: Monorepo/Packages Architecture/Micro apps. Every feature of an app is a package, it's tricky because we need to register the "modules" routes, dependencies, and so on.

https://rodrigolmti.medium.com/building-a-multi-package-project-with-flutter-6c547d18abd5

irvine5k commented 3 years ago

We can not forget automated tests. Widget and Unit are enough I guess.

If you provide one of these examples I can help with tests and other examples. Just need some direction because I don't have experience with a global state.

gildaswise commented 3 years ago

I would also recommend adding something about error handling! That's one overlooked issue (pun intended) on most state management tools on Flutter that would be nice to see explored here; good job overall!

aloisdeniel commented 3 years ago

I started to work on the documents example !

I started with state first, but it is a good start to see how I'm using the tool.

irvine5k commented 3 years ago

It's definitely a good start, thank you.

I have doubts if using another package(freezed) to demonstrate the package is good. I think you added an additional cognitive load to people understand the sample since you need to digest two concepts in a row.

Don't get me wrong, I appreciated your effort and freezed is a good package.

aloisdeniel commented 3 years ago

Hi!

The idea of the documents example is to have a "real-world" example. And honestly, I couldn't imagine using the package without freezed, or without data classes at the language level...

I will probably integrate an intermediate example afterwards with the bare minimum because, as you said the learning curve is tough if you're not familiar with freezed.