What is the difference between flutter plugin and flutter module?

Shahzad Akram picture Shahzad Akram · Feb 17, 2019 · Viewed 9.3k times · Source

I am new to flutter plugin development, I have read Developing packages & plugins and Writing a good Flutter plugin, but I am confused as a beginner, I have developed Flutter Application based on webview_flutter and a JavaScript library to work offline. I want to extend it as a module or a plugin.

Webview renders some stuff. JavaScript library is being attached from assets.

I am not calling any Platform API directly from my code but my code depends on another plugin.

How do I proceed this? As a plugin or as a module?

Answer

Günter Zöchbauer picture Günter Zöchbauer · Feb 17, 2019

A plugin is about making native functionality available to Flutter.
A module is about integrating Flutter with an existing native application.

Perhaps what you actually want is a reusable Pub package that you can publish to pub.dartlang.org (a plugin is also a Pub package, just a special one that additionally utilizes access to the native platform)

See also

A "library package" is a Pub package in contrary to a plain Dart "application package" which is usually not published to pub.dartlang.org.

A pure Dart Pub package (library package) that does not depend on dart:html, dart:ui (Flutter) and is not a Flutter plugin, can be used on any platform (server, command line, Flutter, browser).

If your package has one of the named dependencies, it is limited to a specific platform.

pub.dartlang.org shows labels to categorize published packages accordingly (FLUTTER,WEB,OTHER)

enter image description here