简体   繁体   中英

How to compare to home screen in splash screen on flutter

Suppose, I have two users on this App (Teacher & Student). Their platform or home screen is different and so is the login, and registration section. Now I want the login status (student or teacher) to compare the splash screen to see who has the login and send it to its home screen. How can do this? enter image description here

You need to assign a role each user, and then do the routing based on the role. 2 places where you can store the role information:

  • In the Firebase Authentication token of that user as a custom claim
  • In the database, either as a document associated with that user or in a table if you're using SQL. Please create a different table to store user details and use the user id as a foreign key. Do not mess with the tables generated by the authentication provider.

Always set the role from a trusted environment, otherwise your users will be able to change their own roles.

Once this is done, you can access the role information from your app and do role based authorization (in your case, routing)

You can make role-based authorization. Here is an example .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM