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.

Bud1	oidbwspblandroidbwspblob�bplist00�			
	]ShowStatusBar[ShowPathbar[ShowToolbar[ShowTabView_ContainerShowSidebar\WindowBounds[ShowSidebar			_{{347, 202}, {920, 464}}	%1=I`myz{|}~��androidvSrnlong @� @� @� @E	DSDB `� @� @� @
LoggedUser class

The main function is the entry point of ...