Mono-repo, add a plugin

This part is a follow up on https://yapb.dev/2021/03/07/mono-repo-with-flutter-and-android-studio/

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 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 MY_PLUGIN

We will use Android Studio to review and commit files.

Choose Commit

ADD MY_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.

Select “Create module from existing sources”, choose “Next”
Deselect all lines, except the one with Flutter, choose “Next”
Deselect all, choose “Finish”

COMMIT ADD MY_PLUGIN AS A MODULE

Choose “Commit”

ADD MY_PLUGIN AS A DEPENDENCY

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

COMMIT ADD MY_PLUGIN AS A DEPENDENCY

Choose “Commit”

CHANGE MAIN.DART TO USE MY_PLUGIN

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

COMMIT CHANGES TO MAIN.DART

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

Published by Sander Roest

Professional app developer.

One thought on “Mono-repo, add a plugin

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

<span>%d</span> bloggers like this: