I am very new to Flutter
, and stuck at the following error:
package:http/http.dart That library is in a package that is not known.
Maybe you forgot to mention it in your pubspec.yaml
file?
Please help in resolving this error.
Open the Pubspec. yaml file and add the dependency as library name: version number as shown in the figure below. Then it will automatically install your package into your system in either of the above two ways. Now you are pending with just importing the package into the required module.
Go to your pubspec.yaml
file , and add the http
dependency:
dependencies: flutter: sdk: flutter cupertino_icons: ^0.1.2 http: any
Remember, the indentation must be the same as 'flutter' or 'cupertino_icons'
And don't forget to run this command in your terminal :
flutter packages get
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With