Chrysolites Tech Academy

Video by Joel Loh | AI Automations · streamed from YouTube. All rights remain with the creator.

Lesson 24: Unfollowing Users with Triggers

About this lesson

In this part of the series, Joel Loh completes the follow system of the photo-sharing app by allowing users to unfollow other users, again making use of core database architecture concepts such as intermediate tables, together with Supabase triggers, to store and maintain the state of who follows whom. It begins by building the unfollow function in FlutterFlow, so that a user who already follows someone can stop following them, with the action removing the relationship recorded in the intermediate table created in the previous part and the interface updating to show the new state. Because each profile displays how many followers a user has and how many people they follow, removing a follow must also update those numbers. The video therefore creates an unfollow trigger in Supabase, a function that the database runs automatically whenever a follow is removed, so that the follower and following counts go down at the right moment without the app having to manage them itself. A test then confirms that following and unfollowing work together correctly, with the button and both counts changing as they should for each user involved. By the end of this short video, the app has a complete follow system in which users can follow and unfollow each other and see accurate statistics, and the next part creates the rest of the profile pages and adds the edit profile functionality. Afterwards, read Chapter 24 of the course book, which follows a count through a sequence of events by hand.

Install Chrysolites Tech Academy

Android / Chrome / Edge: open the browser menu and choose Install app or Add to Home screen.

iPhone / iPad (Safari): tap the Share button, then Add to Home Screen.