How to set up a Flutter project from an existing Github repo using Android Studio

How to set up a Flutter project from an existing Github repo using Android Studio

So, you've found this Flutter app on Github that you'd like to run locally on your machine. In this guide, I'll show you how to do this step by step.

Download the Github repo

First, download the github repo. This can be done either through:

git clone https://github.com/ConProgramming/flutter-example.git

Or using the Github Desktop app, as seen below: Screenshot 2022-04-22 at 17.41.24.png

Open the project in Android Studio

Next, select Open in Android studio and pick the repository you've just downloaded. Screenshot 2022-04-22 at 17.42.25.png

Make sure to select the folder that contains the pubspec.yaml file. This is the main configuration file that contains all the information Android Studio will need to automatically setup the project.

Screenshot 2022-04-22 at 17.47.04.png So in the image above, the selected folder should be flutter_login

Setup the project in Android Studio

You will land on a page that will look something like that:

Screenshot 2022-04-22 at 17.51.58.png Click on the main.dart button at the top and then on Edit configuration.

Next, click on the Fix button on the page you just opened:

Screenshot 2022-04-22 at 17.52.50.png

Then, switch from the Dart to Flutter menu on the left, and choose the Flutter version you have installed on your computer.

Screenshot 2022-04-22 at 17.53.34.png

Finally, click OK & OK again on the bottom right of the pop up pages that have been opened to save your settings.

Install dependencies and run the app

You're done! The play button should now be green! Now there is only one step left, installing the dependencies. For this, visit the pubspec.yaml file and hit the Pub get button.

Screenshot 2022-04-22 at 17.55.50.png

Once that's done, just select a device to run the app on (Chrome (web) is probably the easiest to get started) and hit that green play button!

Screenshot 2022-04-22 at 17.57.17.png

Nice work!