DEV Community

Alexandre Freire
Alexandre Freire

Posted on

2 1

Flutter Target of URI doesn’t exist: ‘package:http/http.dart’

O erro Target of URI doesn’t exist: ‘package:http/http.dart’ acontece pois na mais recente versão do Flutter, o pacote Http não é mais incluído por padrão.

Para que você consiga incluir o pacote Http ao seu projeto, adicione o plugin do Http no seu pubspec.yaml da seguinte maneira:

dependencies:   
  flutter:
    sdk: flutter

  cupertino_icons: ^0.1.2
  http: ^0.12.0+2            # copie apenas esta linha e cole nas suas dependências
Enter fullscreen mode Exit fullscreen mode

Logo após clique no botão flutter packages get e pronto!

Aviso

1) Deixe esta nova linha alinhada com a linha do cupertino_icons, dando 2 espaços do lado esquerdo.

2) Utilize sempre a versão mais recente deste plugin, que você pode encontrar aqui: https://pub.dartlang.org/packages/http#-installing-tab-

Fonte: https://www.udemy.com/curso-completo-flutter-app-android-ios/

Top comments (0)

Sentry growth stunted Image

If you are wasting time trying to track down the cause of a crash, it’s time for a better solution. Get your crash rates to zero (or close to zero as possible) with less time and effort.

Try Sentry for more visibility into crashes, better workflow tools, and customizable alerts and reporting.

Switch Tools

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay