Flutter: How to resolve Error importing package:http/http.dart

Go to your pubspec.yaml file , and add the http dependency:

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^0.1.2
  http: any

Remember, the indentation must be the same as ‘flutter’ or ‘cupertino_icons’

And don’t forget to run this command in your terminal :

flutter packages get

Leave a Comment