LoginSignup
6
6

More than 3 years have passed since last update.

flutterでimport 'package:http/http.dart' as http; をするのに必要な設定

Last updated at Posted at 2020-05-26

やりたいこと

main.dart
にて

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

記載時、

Target of URI doesn't exist: 'package:http/http.dart'.
Try creating the file referenced by the URI, or Try using a URI for a file that does exist.darturi_does_not_exist
Peek Problem (Alt+F8)
No quick fixes available

になった場合の対処。

対処法

  • pubspec.yaml を開く。

  • dependencies: の記述を確認する。

  • 下記のように追記する。

dependencies:
  http: ^0.12.0

下記コマンドを実行する

flutter packages get

すると

Target of URI doesn't exist: 'package:http/http.dart'.
Try creating the file referenced by the URI, or Try using a URI for a file that does exist.darturi_does_not_exist
Peek Problem (Alt+F8)
No quick fixes available

が消える。

関連リンク
https://flutter.dev/docs/cookbook/networking/fetch-data

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6