sample_plugin
This is intended to serve as a starting point for writing your own Windows
and/or Linux plugin, since flutter create
does not yet support Windows
or Linux.
Before continuing, read the main plugins README if you haven't already.
Use
- To create an entirely new plugin, or a federated Windows/Linux implementation
of an existing plugin, copy the entire
sample
directory.- Update the
pubspec.yaml
as normal for a plugin. Look for comments containing***
and update those entries as described in the comment. - Delete the directories for any platforms you aren't supporting.
- Update the
- To add desktop support directly to an existing plugin, copy the
windows
and/orlinux
directories into that plugin.- Update the plugin's
pubspec.yaml
to include the new platforms. If you haven't already, you'll need to switch to the newplugins:
format, as the legacy declaration doesn't support desktop.
- Update the plugin's
WARNING: The plugin APIs, plugin tooling, and plugin structure for Windows and Linux are not at all stable. Plugins created using this sample are subject to breakage at any time, and will need to be updated any time any of those things change. This means you should not publish Windows or Linux plugins to pub.dev as anything published now will almost certainly not work with the final Flutter Windows and Linux support.
Windows
- Change
sample
in all the filenames to your plugin's name. - Change the
FlutterPluginName
inPluginInfo.props
to your plugin's name. - Look for comments containing
***
in the.h
and.cpp
file, and update the code as described in the comment.
Linux
- Rename
sample
in all the file names with your plugin's name. - Change the
PLUGIN_NAME
in theMakefile
to your plugin's name. - Look for comments containing
***
in the.h
and.cc
file, and update the code as described in the comment.