Add more information about developing desktop plugins #7164
Labels
d.enhancement
Improves docs with specific ask
dev.integration
Relates to platform integration
dev.plugin
Relates to Flutter plugins
e3-weeks
Effort: < 4 weeks
lang.native-code
Involves Swift, ObjC, Java, or Kotlin code for mobile apps
p2-medium
Necessary but not urgent concern. Resolve when possible.
t.desktop
Relates to desktop compatibility of an app
What information is missing?
The Developing Packages & Plugins document should go into more detail about writing plugins for desktop platforms. As a desktop plugin author myself, I have struggled mightily with the nuances of writing a plugin in Swift for macOS, C/C++ for Windows, and C/C++ for Linux (which seems to be different than the C/C++ for Windows). Doing something as simple as reading
PlatformChannel
arguments required a frustrating level of researching. The API docs for the native Flutter platform code (things likeFlutterResult
, etc etc) are super hard to find and are also poorly documented. The only existing codelab for desktop provides zero explanation for the step that covers writing a plugin.Basically, there is little to no documentation available on this subject as it relates to desktop. Given that all three desktop platforms are now officially stable, I believe it is past time for in-depth documentation to be provided by Flutter on writing desktop plugin.
A section of this document that might be good for (some, if not all of) these details is Step 2: Implement the package. Alternatively, it could be its own section, or even its own page.
Here are some of the topics I have struggled with in the past. All code snippets are from a real plugin I'm working on to generate thumbnails from videos:
PlatformChannel
argumentsMap
argumentsMap
arguments back to FlutterMap
argumentsMap
arguments back to FlutterMap
arguments (real code sample):EventChannel
s (not related to the thumbnail plugin)MediaFoundation
library. Linking that library to thewindows
runner was infuriatingly difficult, and it took several days, a lot of research, and help from several people to get this working. It required creating a dedicatedcmake
file to find the library and modifyingCMakeLists.txt
, and the nuances of both of those steps work were hard to figure out. Documentation from Flutter on this would have been quite helpful.ffmpeg
library, but stopped because its such an enormous headache. Again, documentation on this would be super helpful.I'm sure that there are many more nuances related to writing desktop plugins for Flutter that people struggle with.
How would you like us to fix this problem?
Please consider writing in-depth documentation on this subject. I'd be happy to collaborate on this, if desired.
The text was updated successfully, but these errors were encountered: