0

I'm having this issue

im getting data from server and whenever the futurebuilder starts i get this error and nothing happens no data, in the server side everything is ok

 :  FutureBuilder( < Whats causing the error to be thrown
        future: getAppointmentDetails,
        builder: (context, snapshot){
          if(snapshot.connectionState == ConnectionState.waiting){
            return Container(
                height: MediaQuery.of(context).size.height,
                width: MediaQuery.of(context).size.width,
                child: Center(child: CircularProgressIndicator()));
          }
          else if(snapshot.connectionState == ConnectionState.none){
            return Container();
          }
          else{
            return Stack(
              children: [
                appointmentListWidget(doctorAppointmentDetailsClass.data), << stack when error thrown
              ],
            );
          }
        },
      ),
MetalSaint
  • 53
  • 10
  • Does this answer your question? [What is a NoSuchMethod error and how do I fix it?](https://stackoverflow.com/questions/64049102/what-is-a-nosuchmethod-error-and-how-do-i-fix-it) – nvoigt Oct 29 '21 at 12:28
  • Unfortunately it does not answer my question, thank you for the input – MetalSaint Oct 29 '21 at 12:32
  • So did you "Use the stack trace that came with the error message to find out exactly which line the error was on. Then set a breakpoint on that line. When the program hits the breakpoint, inspect all the values of the variables. One of them is null, find out which one."? – nvoigt Oct 29 '21 at 12:35
  • the stack trace points out to FutureBuilder it gets the data using api and I know there is data because its on the api admin and its there – MetalSaint Oct 29 '21 at 12:36
  • So... "you know". You haven't actually started the debugger? This isn't religion, "I have faith there is data" is not helping :) Go start the debugger, in the line you already identified, your variable is `null`. I cannot help you any further, because I have no idea where that variable comes from or why it should not be null. – nvoigt Oct 29 '21 at 12:39
  • its a listdata includes id,name,time it gets filled to sqllite from api and using json all checks out for me, the debugger just points out FutureBuilder and thats it, thank you for the help though – MetalSaint Oct 29 '21 at 12:42
  • Okay, I will spell it out one last time... set a breakpoint in the line the debugger points you to. You even marked it as "<< stack when error thrown". Then when you get there, inspect all variables (hint, there is only one variable on that line) and then you will see it is null. Again, *why* it is null is not something I can tell you, because you have not posted a line that would make me think it could be anything *but* null. You will need to figure that out. – nvoigt Oct 29 '21 at 12:50

0 Answers0