Closed KRTirtho closed 2 years ago
Hi! Thanks for opening your first issue here! :smile:
I guess an example with plugin is much more needed as people provide native implementation with plugins to their Applications. IMO, a working example using Flutter plugin using FRB will be perfect to clear all the confusions for all the plugin developers
@KRTirtho Agree. Currently I do not have much time for this tutorial, but I may find some time later if there is much need.
Of course do it when ever you're free. But for the moment, can give me any clue/suggestion about this problem? It'd be really helpful
Just search: how to integrate a rust code into a flutter code?
or, more generally: how to integrate an arbitrary command (e.g. "cargo build", but it can also be "gcc compile-something" or "your-fancy-command run-something") into a flutter plugin when flutter compiles?
and, since your bug is about "cannot load the .so file", just search: how to integrate a .so file into flutter plugin? you know, rust .so is no special. it is just the same as a .so file you get by compiling C or C++ or sth.
Well, I managed to load the .so or .dll file used in the plugin in an application. The way is one have to do the all the CMake related configuration on the application & point the corrosion manifest to the flutter/ephemeral/.plugin_symlinks/<plugin-name>/<crate-name>/Cargo.toml
. That means the rust.cmake
also needs to be created on each application's linux
or windows
directory. Its usable but the end user have to manually do this cumbersome configuration
Bundling a prebuilt library with your plugin is the solution.
Please take a look at this repo I created as an example for a flutter plugin with rust.
It supports iOS, Android, MacOS, Windows, and Linux. Although I haven't tried the Linux version yet and its library was cross compiled on my windows machine.
The example folder is a stock example that flutter creates for the plugin except that the function it calls is changed.
Hope this helps.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue.
Describe the bug
I'm using flutter_rust_bridge in a plugin & using that plugin in an Flutter Application (example application of the plugin). I guess I followed all the instructions of the docs but my application fails to load the dynamic library
Following are the error logs
Codegen logs with
RUST_LOG=debug
env variableTo Reproduce
Run following commands
git clone -b impl-rustee-rowdy https://github.com/KRTirtho/rowdy.git && cd rowdy
just gen
just example
Expected behavior
Dynamic Library should get loaded while using the plugin inside an Application & bindings should work
Generated binding code
OS
Endeavour OS (Gnome Edition) Linux
Version of
flutter_rust_bridge_codegen
1.30.0
Flutter info
Version of
clang++
13.0.1
Version of
ffigen
4.1.3
Additional context
https://github.com/fzyzcjy/flutter_rust_bridge/discussions/460