This repository is a quick-start template for Membrane to provide the minimal Rust needed to get started (just 3 files!).
The files of interest are in rust_example:
Running cargo build
in the rust_example
directory compiles the library to the target
directory and running
cargo run
in the rust_example
directory produces the dart_example
directory. You can then
switch to that dart_example
directory and, while referencing the compiled library, run the Dart CLI application:
LD_LIBRARY_PATH="../rust_example/target/debug/" dart run
and observe it printing to the console. (On different operating systems you will need to adjust the variable name, for example on MacOS adjusted for dylib:
DYLD_LIBRARY_PATH="../rust_example/target/debug/" dart run
).
The dart_example directory is a minimal pub dependency which can easily be consumed by any Flutter application. To observe a basic Flutter application change to the flutter_example
directory on your favorite platform and execute flutter run
while specifying the path to the library directory (not the library file itself). For example on Linux desktop with the library compiled in debug mode with cargo build
you would use LD_LIBRARY_PATH="../rust_example/target/debug" flutter run
.