やりたいこと
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