Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use flutter plugin, that I created, in my flutter app as local plugin

I have created a flutter plugin for android and ios and I want to use that plugin in my flutter app locally. I don't want to upload it to pub.dev but to use it locally in my flutter app. I searched a bit and I found that I can use external packages locally but I didn't find anything about a plugin. These are directories under my plugin package all_pdf_tools:

enter image description here

Out of these which directory do I need to move to my flutter app directory and then how should I declare it to use it in my pubspec.yaml and then how can I use my plugin's methods in the flutter app.

Thank you.

like image 225
Martin Avatar asked Dec 11 '25 23:12

Martin


1 Answers

Make sure that your Flutter app and plugin are in sibling folders.

The add a dependency in pubspec.yaml of your Flutter app:

dependencies:
  all_pdf_tools:
    path: ../all_pdf_tools

This tells your Flutter project to look for your plugin at the relative path, rather than in pub or a local git repo.

(If you look in all_pdf_tools/example/pubspec.yaml you'll see this is how the example app refers to its plugin by using path: ../)

like image 147
Richard Heap Avatar answered Dec 15 '25 21:12

Richard Heap



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!