Connecting Events and States

Connect event classes and state classes together using tools provided by the flutter_bloc library.

Now that our events and states are set in place, it’s time to convert events to states. We have three events: GetLikes, AddToLikes, and RemoveFromLikes. All of these events are going to access the local storage to save and get the likes. So first, let’s implement the storage service.

Storage service

We need two functions in the storage service:

  • save() function: This saves the liked items in the local storage

  • get() function: This gets the liked items from the local storage.

Get hands-on with 1200+ tech skills courses.