Making Your Own Packages

Now that you know how to use a package, you might want to know how to make your own package and how you can write platform-specific code to be used inside a Flutter app.

Creating the Package

Making a package is a lot like making an app.

If you’re using Android Studio, you just need to use File -> New -> New Flutter Project.

If you only need to use multi-platform Dart code for your package, choose the Flutter Package option, if you also need to add iOS(Objective-C/Swift) or Android(Java/Kotlin) code, choose Flutter Plugin.

Interaction between Dart code and platform-specific code is described in Integrating Native Code: Making Plugin Packages.

If you’re using the command line, run this command:

 flutter create --template=package ...

Get Programming Flutter now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.