I am facing a anonymus closure error in flutter while signing in a user. It worked a few days before but now its not working, I dont no why. So please help and thanks in advance
I also have similar type of error, Be make sure that the argument of .decode
method shouldn't be empty object. Instead of using this line:
var body = json.decode(response.body);
Try
if(response.body.isNotEmpty) {
json.decode(response.body);
}
Do try this, hope it will work for you.
I had similar type of problem, i tried everything but eventually the problem was that I was using http intead of using https even though the apis was in https, i forgot to add s at in http. After changing to https from http the error was gone.
Print your body and double check you aren't trying to decode an array rather than on object.