-
-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Questions about Plugin Development for flutter-pi #466
Comments
Hey @kyle-seongwoo-jun, yes, your assumptions are correct. You can either have it in the flutter-pi source tree directly, or you build it externally somehow and use
That is unfortunately incompatible right now.
If you're using custom-devices, you can use the
You can write C++ plugin code, there's also a sentry plugin and sentry uses C++. You just need to be a bit careful when interfacing the C code. E.g. the flutter-pi headers don't have #ifdef __cplusplus
extern "C" {
#endif guards, so you need to put those around the Can I ask what kind of plugin you want to write? In general, I'm very happy to include any plugins in the flutter-pi repo |
@ardera, Thank you for the detailed response; it was incredibly helpful! The project I am considering involves creating a system that continuously captures microphone input on a Raspberry Pi, recognizes songs, and visualizes the results in real-time. To achieve this, I have been thinking about migrating the Linux implementation of the record package for flutter-pi. Additionally, I am considering using SongRec or vibra to implement the song recognition functionality as a Flutter plugin. (By the way, I just realized that the Linux implementation of the record package doesn’t rely on a native C++ implementation. Instead, it interacts with the Thank you again for your support! |
Thank you for this amazing project!
I deeply appreciate your efforts in creating and maintaining such an incredible project.
Currently, I am interested in writing plugin code for flutter-pi. This includes both writing new plugins or implementing existing plugins from pub.dev for flutter-pi.
However, I noticed that there isn’t detailed documentation about this topic in the README or the Wiki. I have searched and reviewed related GitHub issues and thought it might be helpful to have this information documented.
From my understanding, there seem to be two main approaches for plugin development:
Writing C code in
src/plugins
I understand this method involves forking the repository, adding the C implementation in the
src/plugins
directory, building the modified flutter-pi binary, and deploying it to the Raspberry Pi.Using FFI
This approach follows C interop using dart:ffi as documented in Dart’s official guidelines.
I’d like to confirm if my understanding is correct.
Assuming it is, I have the following additional questions:
In the case of the first approach, is it possible to use the
flutterpi_tool
build method (described as the "New Method" in the README), or is this method incompatible?Is there a way to build C plugin code during the Flutter app build process, without needing to separately build the flutter-pi binary?
(If question 2 is possible) Would it also be feasible to implement a system where plugins for flutter-pi are distributed as pub.dev packages, similar to other custom embedders like Tizen or Sony eLinux?
a. Tizen plugins
b. Sony eLinux plugins
If I want to use C++ code for a plugin, is the second approach (FFI) the only viable option?
Thank you for your time and for reading this!
The text was updated successfully, but these errors were encountered: