Reputation: 81
When trying to import http package I can see the red underlining as it is error.
In terminal I tried running "flutter clean" and then adding "http: ^0.12.0" to pubspeck.yaml and running "flutter packages get" but it shows: "Could not resolve URL "https://pub.dartlang.org". pub get failed (69)"
Packages like "flutter/material.dart" are correctly imported. Don't know what to do.
Could this be issue with http not being back-compatible with flutter 1.0?
Upvotes: 4
Views: 7561
Reputation: 153
On Linux/macOS:
$ export https_proxy=hostname:port
On Windows Command Prompt:
$ set https_proxy=hostname:port
On Windows PowerShell:
$ $Env:https_proxy="hostname:port"
If the proxy requires credentials, you can set them as follows.
On Linux/macOS:
$ export https_proxy=username:password@hostname:port
On Windows Command Prompt:
$ set https_proxy=username:password@hostname:port
On Windows PowerShell:
$ $Env:https_proxy="username:password@hostname:port"
For more information refer this link
Upvotes: 4
Reputation: 8014
This usually happens when you are behind proxy. To see what proxy it is using use following commands on Mac -> Terminal
echo $ALL_PROXY or echo $https_proxy
Set appropriate proxy using -
export https_proxy="https://<username>:<password>@<proxy>:<port>"
There will be a strange problem here though, if your password contains "@" then you can either try to replace it with special character %40
or worst case change your password to something with _
.
Upvotes: 0
Reputation: 81
So the problem was I was behind proxy and added enviromental variables (https_proxy) as strings in quotation marks, where they should be added without " ". More here (https://www.dartlang.org/tools/pub/troubleshoot).
Upvotes: 4