LoggedUser Model
Learn how to build a class for logged-in users.
We'll cover the following
The LoggedUser
class will keep an instance of the currently logged-in users and their details like name, email, etc. It also includes the following functions:
upgradeMembership()
: It updates the user’s membership from standard (default) to premium.fetchMembership()
: It returns the current membership type that the user has.setPurchaseToken(String val)
: It sets the purchase token of the user.setProfileInfo()
: It fetches the user’s profile information from the Firestore and stores it in the app.
Implementation
Create a .dart
file inside the models
folder and name it logged_user.dart
.
Get hands-on with 1400+ tech skills courses.