Add package from GitHub to Fluter
Add package from GitHub to Fluter

Hi Guys, Welcome to Proto Coders Point. In this Article we will learn how to add github package to flutter project.

Sometimes we need to use latest flutter packages that is not yet been published in but available in github repo.


In you have built your own flutter package & pushed it on github repository but not published in, at that time you can add packages from github to flutter project directly.

How to Download Packages from Github to flutter

Open pubspec.yaml file and under dependencies section add the path to your get repository.

1. Method One

    git:  <--- url --->

2. Method two – git from target branch

    url: <--url-->
    ref: dev

Here package_name descrives the name of the package,

git, it say pubspec.yaml to search for the package from github repo & url after that is to specify from where to clone the package.

Here package name, should be same as the name specified in pubspec.yaml of that github flutter package.

how to add package from github in flutter pubspec.yaml – Example


The above, will download the package directly from github repo into your flutter project.

now you can import it and use anywhere in your flutter project eg: main.dart

import 'package:http/http.dart' as http;