1

i was attempting to make an http request to a server, but when i import the package http the vs code print the next error:

Unable to find modules for some sources, this is usually the result of either a
bad import, a missing dependency in a package (or possibly a dev_dependency
needs to move to a real dependency), or a build failure (if importing a
generated file).

Please check the following imports:

`import 'package:http/http.dart' as http;` from fcfm_pa|lib/src/pages/registro_page.dart at 5:1

someone knows what's happen?

1
  • The easiest way that I was able to solve this problem was to change from beta channel to master channel. I would suggest anyone facing this issue to do the same.
    – Raycherr
    Commented Mar 7, 2020 at 14:26

2 Answers 2

1

You should update your pubspec.yaml file with the following library declaration:

dependencies:
  http: ^0.12.0+4

and then import the library. After doing so, make sure to do over the terminal:

flutter pub get

and maybe even flutter clean to make sure you have everything correctly. Make a new build and you should be good to go.

2
  • now i get the next error "Failed to build application for the Web." Commented Feb 11, 2020 at 2:53
  • could you add your "flutter doctor -v" over your answer? So we can know your specific version, etc Commented Feb 11, 2020 at 5:29
1

If you are on beta channel, this is an issue that occurs.

Try flutter channel master and then run the app again, this issue should not appear anymore.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.