Rust integrated Dart Flutter Project
Use the below scripts to get the app ready to run with Flutter.
./sh/bindgenRun any of the below three to build the binary for the specific device and have it placed into the devices specific plugin folder.
./sh/macosRun on the device.
flutter run -d macosRun step 1 whenever a function exposed to Flutter changes.
Run step 2 whenever any of your Rust code changes.
Note that to apply changes from Rust you need to restart the app to reload the compiled binary. A hot restart/reload does not achieve this.
├── android
├── ios
├── macos
├── lib
├── plugin
│ ├── android
│ ├── ios
│ ├── macos
│ └── lib
└── src
Provides connection from Flutter to Rust.
Rust binaries are placed into the respective plugin folders ./ios, ./macos, ./android when
they are built.
Generated Dart glue code is placed inside ./plugin/lib/generated while
./plugin/lib/plugin.dart just exposes the API to the app.
Contains the starter Rust code inside ./src/lib.rs. Keep developing the Rust part of your app
here.
Contains the starter Flutter app inside ./lib/main.dart.
Provides scripts to run build and code generation tasks. In the future a tool will provide the functionality currently provided by these scripts.
bindgengenerates thebinding.hheader file for the extern Rust functions found inside./src. These are then placed inside the./plugindevice folders were needed as well as./plugin/lib/generated/binding.hwhere they are used to generate Dart glue code- as part of this script
ffigengenerates Dart glue code inside./plugin/lib/generated/ffigen_binding.dartusing./plugin/lib/generated/binding.has input
- as part of this script
./androidbuilds the Rust binary to run on Android devices/emulators and places it inside./plugin/lib/android./iosbuilds the Rust binary to run on IOS devices/emulators and places it inside./plugin/lib/ios./macosbuilds the Rust binary to run on MacOs directly and places it inside./plugin/lib/macos, this is the same format as runningcargo buildon your Maccleancleans both the Flutter plugin and application, run this to reset Flutter when things aren't working