DEV Community

Arbitrary
Arbitrary

Posted on

Using external packages in flutter

Automatic way

Run either of the following commands in the terminal ( inside your project directory) to add the package to your project.

dart pub add package_name

or 

flutter pub add package_name
Enter fullscreen mode Exit fullscreen mode

Manual way

  1. go to pub.dev
  2. search your package
  3. go to installing tab and copy the package name and version under dependencies
  4. open pubspec.yaml file present in root directory
  5. paste it under dependencies.(be careful about the indentation)
  6. save and your ide will download the package in the project.
  7. go to the dart file where you want to use it and import at the top

That's it. Now you can use the package however you like.

Top comments (1)

Collapse
 
pablonax profile image
Pablo Discobar

I really like it! if you are interested in this topic, then check this article - dev.to/pablonax/free-flutter-templ...