With the Deferred and Future Observables, we have streams that are both re-usable and re-buildable. With a broadcast stream, you can listen to the stream as many times as you need but once the stream is closed, it can't be reopened. With a normal stream, you may only listen to the stream a single time. These types of Streams are perfect for the data that is inside of our BLoC because the data is a single event. In the new BLoC, we use both deferred and future based observables. In this pattern, we are able to selectively update and change the widgets that need dynamic information while minimizing the rebuilding of widgets that do not. Our second BloC Provider appears further down the tree and it can only give its associated BLoC to widgets that are directly below it on the tree. This provider can give the state of the BLoC to any of the widgets below it on the tree. The first BloC Provider is in the root widget. If our widget tree looks like the diagram above, we have two separate BLoC providers. Not only does this make the code more modular but it also allows us to inject the BLoC into areas of the application where it is needed. In the interest of separating the concerns of our application, it makes sense to create a second BLoC structure to handle the serving of the application metadata to the user. In the last tutorial, we used it to serve the main contributions to the user interface. The Business Logic Component pattern is very flexible. Adding Multiple BLoCs to a Single Flutter Application The drawer uses the package information library and the GitHub releases API both of which get served through a second BLoC structure. This drawer displays information about the application to the users and it allows the users to update the application. In this video tutorial, we extend the Utopian Rocks flutter application by adding an information drawer. Basic knowledge of how to read JSON-like data or ARB data.A fair understanding of Mobile development and Imperative or Object Oriented Programming.An Android or iOS Emulator or device for testing.The Flutter SDK on the latest Master Build. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |