flutter bloc pattern

  • 文字教程

https://www.raywenderlich.com/4074597-getting-started-with-the-bloc-

pattern

 

  • 概念

This architectural contract is not too dissimilar from classical MVC. The UI/Flutter layer can only talk to the BLoC layer. The BLoC layer sends events to the data and UI layers and processes business logic. This structure can scale nicely as the app grows.

 

Streams, like Futures, are provided by the dart:async package. A stream is like a Future, but instead of returning a single value asynchronously, streams can yield multiple values over time. If a Future is a value that will be provided eventually, a stream a series of values of that will be provided sporadically over time.