Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter Packages Get in VS Code failing

Recently got started with Flutter 1.0.0. flutter doctor -v no issues Been deploying to an iOS device no worries.

Problem started when I tried to add Dart Packages via the pubspec.yaml file. No packages are installing and it outputs only exit code 0 in VS Code. The extension button at the top of the pubspec.yaml file does not work either.

imports are showing with red underlines and 'URI undefined' so the packages are definitely not downloading and installing.

Any help much appreciated!

Pubspec.yaml file:

name: http_l
description: A new Flutter project.

version: 1.0.0+1

environment:
  sdk: ">=2.0.0-dev.68.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  http: ^0.12.0

dev_dependencies:
  flutter_test:
    sdk: flutter

    flutter:
  uses-material-design: true

and the main.dart file has a red underlined import:

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

with error message:

Target of URI doesn't exist: 'package:http/http.dart'.dart(uri_does_not_exist)
like image 645
Mike Soertsz Avatar asked Dec 17 '18 06:12

Mike Soertsz


People also ask

Can Flutter work on VS Code?

Now We have to set up the Visual Studio Code for the Flutter. We have to install two extensions in order to use flutter. The very first extension is Flutter and 2nd is Dart. Note that Dart is the programming language that is used in flutter for the application development for both and android and iOS.

Is VS Code good for Flutter?

While VS Code is great for all types of programming languages, it's particularly helpful for Flutter development because it can run flutter commands from within the editor. Flutter's default environment is iOS, but VS Code lets you switch between web and Android environments by clicking on the corresponding button.

Is Flutter better on Android studio or VS Code?

Android Studio has significantly less Flutter-related plugins than VS Code. Searching for “Flutter” on the Android Studio marketplace only yields 61 results. However, all of the critical tools, like packages to help with popular state management frameworks or converting JSON into Dart code are readily available.


1 Answers

install this plug in on vs-code
Pubspec Assist or download from hare form this link

click ctrl+shift+p connend pubspag write your dependency it will fix the error

like image 146
Kalyan Biswas Avatar answered Oct 03 '22 06:10

Kalyan Biswas