'When I wnat to get package flutter it show me HTTP error 403: Forbidden
I am working on flutter project in Intellij Idea. when I want to add a package in pubspec.yaml, it leads to below errror:
HTTP error 403: Forbidden
package:pub/src/http.dart 218:5 _ThrowingClient.send
===== asynchronous gap ===========================
package:http_throttle/http_throttle.dart 33:31 ThrottleClient.send
===== asynchronous gap ===========================
package:pub/src/source/hosted.dart 322:37 BoundHostedSource._download
===== asynchronous gap ===========================
package:pub/src/source/hosted.dart 217:13 BoundHostedSource.downloadToSystemCache
===== asynchronous gap ===========================
package:pub/src/entrypoint.dart 374:48 Entrypoint._get.<fn>
===== asynchronous gap ===========================
dart:async runZoned
package:pub/src/http.dart 272:10 withDependencyType
package:pub/src/entrypoint.dart 370:12 Entrypoint._get
dart:async Future.wait
package:pub/src/entrypoint.dart 231:18 Entrypoint.acquireDependencies
dart:async _completeOnAsyncReturn
package:pub/src/solver/version_solver.dart VersionSolver.solve
dart:async _completeOnAsyncReturn
package:pub/src/solver/version_solver.dart VersionSolver._result
This is an unexpected error. Please run
pub --trace '--verbosity=warning' get --no-precompile
and include the logs in an issue on https://github.com/dart-lang/pub/issues/new
I have tried using vpn and without vpn both of them doesnt work. Also, when i add some common package such as provider or http, its fine.
This is my code:
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
provider: ^3.2.0
http: ^0.12.0+2
font_awesome_flutter: ^8.5.0
flutter_rating_bar: ^3.0.0
my flutter sdk version : flutter_windows_v1.9.1+hotfix.6-stable_3
Could you please help me?
Thanks in advance
Solution 1:[1]
use proxy or vpn your ip address is block https://dart.dev/tools/pub/troubleshoot#pub-get-fails-from-behind-a-corporate-firewall
Solution 2:[2]
It may solve your problem:
- add ".catch-pub" folder in your current project
- add global environment variable "PUB_HOSTED_URL" with value "https://pub.dev/"
Solution 3:[3]
same problem happened for me so i just did
1:flutter clean
2:use 2 vpn at same time
this problem happened because of your connection ;)
Solution 4:[4]
I had exactly the same problem and changed a few VPN, but it was still a problem and did not work
I used a service that changed DNS to fix the problem of sanctions and the problem was solved
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Javad.mrz |
Solution 2 | user6130977 |
Solution 3 | Golnar sheikh bahaie |
Solution 4 | Mahan |