The BLoC guideline step by step

There are several steps involved in implementing a BLoC in your app: I'll highlight them here so that we have a map for the next few steps:

  1. Create a class that will serve as the BLoC.
  2. In the class, declare the data that needs to be updated in the app (in this case, the list of Todo objects).
  3. Set the StreamControllers.
  4. Create the getters for streams and sinks.
  5. Add the logic of the BLoC.
  6. Add a constructor in which you'll set data
  1. and listen to changes.
  2. Set the dispose() method.
  3. From the UI, create an instance of the BLoC.
  4. Use a StreamBuilder to build the widgets that will use the BLoC data.
  5. Add events to the sink for any changes to the data.
  6. Call the dispose() method.

I'll use this list as a map for the steps that we will perform in the remainder of this chapter. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.234.188