7. Setting the dispose() method

As the last step for this class, add a dispose() method, in which you'll close the four StreamController objects. This may prevent memory leaks and errors that are difficult to debug:

//in the dispose method we need to close the stream controllers.
void dispose() {
_todosStreamController.close();
_todoInsertController.close();
_todoUpdateController.close();
_todoDeleteController.close();
}

The BLoC is now complete. The last step required is to implement the user interface in a way that will use the BLoC pattern to deal with the state in our app.

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

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