skip to Main Content

I have an app, when the user clicks on the login button, the user’s information is sent to the profile page after verifying the identity.
Well, no problem so far
The problem is when I use this profile class in several other places and I have to pass parameters to those classes as well.
What is the solution?
Thankful

2

Answers


  1. InheritedWidget could be used for this. Or you could use a more advanced state management solution like Bloc or Riverpod

    Login or Signup to reply.
  2. Here are 2 ways to accomplish what you’re looking for:

    1. Create a profile.dart file, with global variables to store all the information you need. Then for any other page that needs this info, you can use import "profile.dart".
    2. Store all your profile information in a single class. That way, you only need to pass 1 extra parameter when the profile info is needed.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search