skip to Main Content

Error Image

I’m getting The argument type BuildContext Function() can’t be assigned to the parameter type BuildContext.

2

Answers


  1. Chosen as BEST ANSWER

    I solved this by removing the flutter whole folder where it is saved and than remove the Environmental Values and remove path and add new download new Flutter SDK and than again update the path in Environmental Values


  2. You can’t send context to a function when it isn’t even defined in the initstate function. Here you are trying to use provider outside the Build Function which is a no no. What you can do as an alternative is to wrap the function with a Future to give it a valid context :

     WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
       myString = Provider.of<AppData>(context, listen: false).testString;
        });
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search