This script compiles a Rust library for both Android and iOS and copies the generated libraries to the appropriate Flutter project directories. #### Features: - Installs missing cross compilation targets - Compiles Rust for Android. - Conditionally compiles Rust for iOS if running on macOS. - Automatically cleans the build directory before compiling. - Copies `.so` (Android) and `.a` (iOS) files to the Flutter project. #### Usage: 1. Ensure the following are installed: - `cargo-ndk`: `cargo install cargo-ndk` - Android NDK (set `ANDROID_NDK_HOME` or `ANDROID_SDK_ROOT`) - Rust toolchains for iOS targets if compiling on macOS 2. Run the script: ```bash ./rust_to_flutter.sh ``` #### Example: ```bash ./rust_to_flutter.sh ./rust_project ./flutter_project ``` #### Notes: - Android libraries are copied to `android/app/src/main/jniLibs/`. - iOS libraries are copied to the `ios` directory.