Home > Software design >  Flutter 'get method was call on nul' Error
Flutter 'get method was call on nul' Error

Time:04-27

I was doing news app on Flutter and I was working with non-null safety because I was doing the older project.But then I started getting errors and I change my version to make the app with null-safety. Anyways, I changed the version re-edit the code I was thinking that I did great work but suddenly I'm getting this error right now. How can I fix this?

CodePudding user response:

in your import do like below.

import 'package:http/http.dart' as http;

call your response like below...

http.Response response = await http.get(
      endPointUrl,
    );

As of my knowledge we cant declare http with var....thats why its shows error...above code will work

  • Related