# Add a plugin to a mono repository

In this part, we are going to add a plugin to an existing mono-repo.

Open a terminal and go to the packages folder.

### Go to the packages folder

```
cd ~/repos/0000000-demo_mono_repo_app-rubigo/packages
```

### Create a Flutter plugin

```
fvm flutter create -t plugin --platforms ios,android --org com.example --ios-language objc --android-language java --project-name my_plugin ./my_plugin
```

### Open/restart Android Studio

Android studio might not detect the new folder. Restarting Android Studio fixes that.

### Commit plugin

We will use Android Studio to review and commit files.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1639946042989/jOO8qDyBu.png)Choose Commit

### Add plugin as a module

Android Studio => File -> Project Structure => Modules => + => Import Module

Navigate to my_plugin folder and choose “Open”. Be aware that the initial folder that Android Studio suggests might not be part of your current project.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1639946045563/PZ-oRNTTc.png)Select “Create module from existing sources”, choose “Next”![](https://cdn.hashnode.com/res/hashnode/image/upload/v1639946048390/5_E_3j7-0.png)Deselect all lines, except the one with Flutter, choose “Next”![](https://cdn.hashnode.com/res/hashnode/image/upload/v1639946051320/zRz46Wm4s.png)Deselect all, choose “Finish”

### Commit add plugin as a module

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1639946054231/jKc4wTWzZ.png)Choose “Commit”

### Add plugin as a dependency

Open demo_mono_repo_app/pubspec.yaml and add my_plugin, and run pub get.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1639946056112/3wW9HSiHw.png)

### Commit add plugin as a dependency

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1639946058744/UyKNUVIPk.png)Choose “Commit”

### Change main.dart to use plugin

With some small changes, we can call MyPlugin.platformVersion, which gets information about the current OS.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1639946060367/4oySH7A66L.png)![](https://cdn.hashnode.com/res/hashnode/image/upload/v1639946061742/epVITZf0t.png)

### Commit changes to main.dart

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1639946064350/FZbLradVR6.png)Choose “Commit”

### Done

These are all the steps that are needed to add a plugin to the mono-repo.

The app final app can be downloaded from:  
[https://github.com/jsroest/0000000-demo\_mono\_repo\_app-rubigo](https://github.com/jsroest/0000000-demo_mono_repo_app-rubigo)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1639946067427/WK_ezs1M5.png)
![](https://cdn.hashnode.com/res/hashnode/image/upload/v1639946069921/bBxadq3g-.png)

