Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between flutter plugin and flutter module?

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?

like image 262
Shahzad Akram Avatar asked Feb 17 '19 09:02

Shahzad Akram


2 Answers

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

  • https://flutter.io/docs/development/packages-and-plugins/developing-packages
  • https://www.dartlang.org/guides/libraries/create-library-packages

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

like image 60
Günter Zöchbauer Avatar answered Oct 19 '22 08:10

Günter Zöchbauer


Flutter plugins:

In short: Native related developments.

Flutter plugin is the wrapper of the native code like android( Kotlin or java) and iOS(swift or objective c). ... Flutter can do anything that a native application can through the use of Platform Channels and Message Passing. Flutter instructs the native iOS/Android code to perform an action and returns the result to Dart.

Flutter packages or modules:

In short: Make the development faster by using code from util libraries.

Flutter supports using shared packages contributed by other developers to the Flutter and Dart ecosystems. This allows quickly building an app without having to develop everything from scratch.

like image 30
Googlian Avatar answered Oct 19 '22 09:10

Googlian