11/5/2023 0 Comments Flutter provider vs bloc vs reduxRiverpod is a rewrite version of Provider, idea is almost same but with lots of benifits. (personally, I think its an entirely new architecture that has redux-ish event->state for state management, and MVVM-ish for app structure, BLoC-ish using stream and stream builder to bind the state to UI). The pure BLoC is very flexible, you can strictly implement event_stream →BLoC →state_out, you can also value_stream →BLoC →value_stream_outĪnother popular implementation is the flutter_bloc package, which maps the event to state, and your backend is not strictly speaking filled with the stream. One of the BLoC implementations uses pure reactive programming in the backend with the help of RxDart, though, both its advantage and disadvantage are RxDart, as your entire backend is programmed “stream fully”. Therefore the stream solved the problem of setState, and achieved clean reactive binding between back and frontend. The main advantage of the stream is that each StreamBuilder listens to a stream, and only update when that stream changes. However the core principle is to use the stream in the back, StreamBuilder in the UI, to build up reactivity around the stream. Here I’m trying to describe a bit according to my little research and knowledge.īLoC pattern is loosely defined, there are a dozen implementations. When it comes to choose any architecture, design pattern or this kind of similar kinds of things it always comes down to preference, choice, need and applicable scenario and most of the writings ends with up with a solution that is very confusing, and most of the cases pros and con, applicable scenario aren’t described.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |