Problem :-
Solution:-
normally the package should be imported like this:
import 'package:http/http.dart' as http;
but now I get this error:
[dart] Target of URI doesn't exist: 'package:http/http.dart'. [uri_does_not_exist]
did it somehow changed in the new updates of Flutter? if so, how can I perform a get request now?
Solution:-
It is clear way to add http to flutter
- Add this to your package's pubspec.yaml file:
dependencies: http: ^0.12.0
- Install it You can install packages from the command line:
with pub:
$ pub get
with Flutter:
$ flutter packages get
- Import it Now in your Dart code, you can use:
import 'package:http/http.dart';
If you have done these 3 steps restart your code editor
No comments:
Post a Comment