Flutter: State Management-2
The BLoC pattern — ViewModel + Reactiveness ️⚡️ We can use pure dart class as ViewModel and keep the properties as reactive streams. The view layer can add an action in the ViewModel using StreamController’s Sink or Subject from the RxDart package. Those actions can be processed and converted to the View representable property streams in the ViewModel. From the View layer, widgets can react to the ViewModel streams using the StreamBuilder widget. This is the purest reactive form of state management where we can rebuild the necessary widgets by using specific property stream in the StreamBuilder. Following this pattern has additional challenges though. As there will be multiple Sinks for accepting different actions and multiple streams exposed for UI reactivity, it’s very easy to lost tracking the data flow. Let’s see what our rising community has done to solve this problem 😄. 4. The BLoC package The BLoC package mixes the ideology of the BLoC pattern &...
Comments
Post a Comment