ToDo App - Leveraging the BLoC Pattern and Sembast

Designing the structure or architecture of an app is often one of the most important problems that developers need to solve when creating or upgrading an app, especially when the complexity and size of the project grows.

Each language has a 'favorite' pattern, such as model–view–controller (MVC), or model–view–viewmodel (MVVM). Flutter is no exception, and the pattern that Google developers are suggesting at this time is the BLoC (business logic componentspattern. There are many advantages of using BLoCs, and one of them is that they don't require any plugin, as they're already integrated into Flutter.

In previous chapters, you've seen the different ways to persist data in an app, such as SQFlite and the Firebase Firestore database. For this project, we'll introduce another tool so that you can choose the best solution in different contexts—the simple embedded application store database (short for sembast). Using this tool is far easier than remembering its name.

Also, instead of using setState() to deal with the state of our app, we will use the BLoC pattern. This leverages the streams functionality to manage state changes in Flutter. Using the BLoC pattern helps to separate the business logic from the UI.

By the end of this project, you'll be able to use the simple embedded application store database with the BLoC pattern to persist the data and states in your apps. In this chapter's project, we'll use a BLoC pattern as the interface between the UI and the data.

The following topics will be covered in this chapter:

  • Using the simple embedded application store database, or sembast
  • Introducing the BLoC pattern
  • Using BLoCs and streams to update the UI
..................Content has been hidden....................

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