Packages also known as Dependencies are base of every programming language. Like other programming languages flutter also supports external package installation in project. Flutter gives us package sharing environment, using it developer from all over the globe can shear their code with each other. Like NPM package installation for React Native, flutter has its own Pub.Dev website which enables the developers to share their packages with others. The external package installation allows the developer to quickly achieve the functionality he needed without writing code from scratch. So in this tutorial we would learn about How to Install External Package Dependencies in Flutter Project Manually From Pub.dev in Windows MAC for Android & iOS platform.
Contents in this project How to Install External Package Dependencies in Flutter Project Manually From Pub.dev :
1. First to download any external flutter package for your requirement open pub.dev website. Now search for the package you needed in search box. To show you how we can install package in flutter project i am installing HTTP package in my flutter project. Here is the link of HTTP package. No locate Installing Tab on the package page.
2. Now open your flutter project’s pubspec.yaml file in code editor.
4. Here is my pubspec.yaml file source code after adding above dependencies code.
description: A new Flutter project.
sdk: ">=2.7.0 <3.0.0"
5. Now open your flutter project Root directory in Command prompt like i did in below screenshot and execute flutter pub get command.
Here you go guys, Now your flutter package is ready to use. Now import the import 'package:http/http.dart'; package in your project’s main.dart file and use it. So guys hopefully you have understand How to Install External Package Dependencies in Flutter Project Manually From Pub.dev. Happy Reading 🙂 .