0

Hello Flutter/Dart Devs , I'm developing a flutter package . Nearly 80% of the functionality can be achieved in dart itself so that I've written those in dart . And now , for a specific authentication related feature , I need to consume platform-specific code for both android & iOS since the SDK for that feature is available only for android and iOS. So this lead me to a confusion to choose whether I've to create a Flutter Package Template / Flutter Plugin Template.

Most of the Flutter plugins code contains a dart interface containing only method channel calls and every implementation is platform-specific. I felt , for 30% of code my package turns into a plugin . So finally , should I create a Flutter Plugin Template and put all the dart code and platform specific code or what's the better way?

1 Answers1

0

Plugins can have multiple implementations for multiple platforms (e.g. Android, iOS), they contain platform-specific code. Packages contain only one implementation for all platforms, written in pure Dart. The API for Plugins is also written in Dart, the platform-specific implementation in its language (Android uses Kotlin or for some older projects Java, iOS uses Swift or Objective-C, Windows uses C++, ...). So, if you plan to create a "package" with platform-specific code, I would use the Flutter Plugin Template. But if you only need the same code for all platforms, use a package.

Here are some links:

I hope, I could help you!

David
  • 1
  • 2