How to add a Flutter Plugin without publishing to Pub (Android)

I was looking for a way to quickly create Flutter Plugin. I can’t seem to find the exact same plugin on pub.dartlang or any solution about embedding the plugin directly into your Flutter App.

The plugin that I want to implement is the Facebook App Events plugin. Since I needed this plugin for the Android platform only. I wasn’t about to publish a half complete Plugin into https://pub.dartlang.org/.

Step 1: Create the Dart files in /lib

Step 2: Create the Java Plugin in /android/app/src/

Step 3: Register in MainActivity.java

Step 4: Run your App

That’s all.

If you're interested in the implementing FacebookAppEvents for Android. Here is the gist: https://gist.github.com/Fuxingloh/4f565b683ba84914c20e090061f2ad80

--

--

I am a full-stack capable Web, Android, iOS, DevOps, software engineer and architecture.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Fuxing Loh

I am a full-stack capable Web, Android, iOS, DevOps, software engineer and architecture.