Comments (2)
Looking at the gpiod plugin, it looks like a dart package (no native code) combined with a gpiod.c file in the plugins folder.
Exactly, a flutter-pi plugin is just:
- a dart package for the dart-side implementation
- typically, a
my_plugin.c
file insidesrc/plugins
and amy_plugin.h
file insideinclude/plugins
(if you need more files, just create amy_plugin
folder insidesrc/plugins
andinclude/plugins
which contains your plugin source files) - some code inside
src/plugin_registry.c
to make your plugin known to the plugin registry - of course, you also need to update the
Makefile
so it compiles yoursrc/plugins/my_plugin.c
file
It's also "convention" to implement a flag, like BUILD_MY_PLUGIN
, so people can choose when compiling flutter-pi
whether your plugin should be built and included in the finished binary. (To be more precise, the BUILD_MY_PLUGIN
flag should do nothing more than enable/disable the registration of your plugin to the plugin_registry, see here and here)
What are the steps necessary to link and build the .c file and make flutter-pi aware of new plugins?
So, in practice, you'll have to add 6 lines to pluginregistry.c
to make your plugin known to flutter-pi
:
// my_plugin.h should contain the definitions of `my_plugin_init`
// and `my_plugin_deinit`
#ifdef BUILD_MY_PLUGIN
# include <plugins/my_plugin.h>
#endif
// . . .
struct flutterpi_plugin hardcoded_plugins[] = {
// . . . the other plugins' registrations here
#ifdef BUILD_MY_PLUGIN
{.name = "my_plugin", .init = my_plugin_init, .deinit = my_plugin_deinit},
#endif
};
Then you need to update the Makefile
so your plugin gets built:
- Add
src/plugins/my_plugin.c
to the definition of theSOURCES
variable - Add the
-DBUILD_MY_PLUGIN
c-flag to the definition of theREAL_CFLAGS
variable
from flutter-pi.
Perfect, works! Thanks, closing...
from flutter-pi.
Related Issues (20)
- No issue, just looking for some help: Can't load Kernel binary: Invalid kernel binary format version. HOT 1
- No mouse cursor on Ubuntu HOT 1
- I updated the flutter version and reported the following error.(3.19.3) HOT 3
- modesetting.c: Could not set DRM client universal planes capable. drmSetClientCap: Operation not supported HOT 1
- Pi goes back to console mode but the app is running
- Option --dimensions does not take effect HOT 1
- 🐛 throwing DRM and GBM errors w/ latest kernel HOT 5
- Does webview work?
- screen ratio not respected. HOT 2
- MissingPluginException - method setSourceBytes (audioplayers) HOT 2
- error: static assignment failed: Expressionevaluation to false HOT 2
- No output on Odroid M1S when using Vu5S MIPI-DSI display HOT 14
- error: Couldn't create GBM surface for rendering - Rasberry pi 5 with 7 inch DSI official display HOT 6
- Missing Depens in Readme ? HOT 2
- Different resolution in flutter-pi than that of the OS (DSI panel) HOT 4
- Installing on iMX6ULL HOT 6
- Audioplayers MissingPluginException HOT 1
- Orange Pi Zero 3 configuration HOT 3
- Does flutter-pi work on Orange Pi 3 LTS? HOT 1
- Error installing flutterpi_tool HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter-pi.