Injecting provider into another provider? #3715
Unanswered
JakeStarkey
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
After realizing ChatGPT gave me severely outdated code, I'm now attempting to update my project from StateProvider. But now I'm struggling to grasp how to actually create working providers and call them inside my ViewModel.
Before updating, I had a providers file which set up my GraphQLClient, my Repository for making calls, and a ViewModel with a StateProvider of a class that held the API call and the user's current choices made from choosing objects from the JSON.
It looked like this:
final graphQLClientProvider = Provider<GraphQLClient>((ref) { //set up the GraphQLClient }
With each having a constructor that had "this.repository" or "this.provider", etc. to instantiate it in each different class. But now that my ViewModel is constructed like this:
Beta Was this translation helpful? Give feedback.
All reactions