Get and build the SDK
4.1 Linux (x86_64)
The plugin does not compile the Linux library, so build it once per SDK commit.
# needs: docker, git, network, about 8 GB RAM, 20+ minutes (release build with LTO)
mkdir -p ~/spark-build/out && cd ~/spark-build
git init -q spark-sdk && cd spark-sdk
git fetch --depth 1 https://github.com/ibirapay/spark-sdk.git d2ca7cfc6a8efbd15328b05c3fb617e0f7e781ef
git checkout -q --detach FETCH_HEAD
test "$(git rev-parse HEAD)" = d2ca7cfc6a8efbd15328b05c3fb617e0f7e781ef # must print nothing and exit 0
Then compile the Flutter bridge library in Rust 1.95.0 (the version the SDK's rust-toolchain.toml demands):
docker run --rm -i -e RUSTUP_TOOLCHAIN=1.95.0 -e HOST_UID="$(id -u)" -e HOST_GID="$(id -g)" -v "$PWD":/src:ro -v "$PWD/../out":/out rust:1.95.0-bookworm bash -s <<'EOF'
set -euo pipefail
apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends protobuf-compiler libprotobuf-dev
cd /src/packages/flutter/rust
cargo build --locked --features secp-lowmemory,release-max-level-debug \
-p breez_sdk_spark_flutter --release --target x86_64-unknown-linux-gnu --target-dir /tmp/target
cp /tmp/target/x86_64-unknown-linux-gnu/release/libbreez_sdk_spark_flutter.so /out/
chown "$HOST_UID:$HOST_GID" /out/libbreez_sdk_spark_flutter.so
EOF
sha256sum ../out/libbreez_sdk_spark_flutter.so
Notes: the bookworm image gives a library that asks for glibc 2.34 or older symbols, so it runs on current Debian and
Ubuntu. IBIRAPAY's own build script (tool/build-spark-linux.sh in the Caixa repository) additionally pins the Docker image by
digest and sets reproducibility flags; record the SHA-256 of what you ship. Put the .so next to your Linux app's
binaries (in the lib/ folder of the Flutter bundle).
4.2 Android (Flutter)
Requirements: Flutter 3.35.3 or newer (Dart 3.9.2 or newer; IBIRAPAY's app builds with Dart 3.13), Android SDK and NDK
(Flutter's default NDK is used), Rust installed through rustup (cargokit adds the Android targets itself); if the build
complains about protoc, install protobuf-compiler. In pubspec.yaml:
dependencies:
breez_sdk_spark_flutter:
git:
url: https://github.com/ibirapay/spark-sdk.git
ref: d2ca7cfc6a8efbd15328b05c3fb617e0f7e781ef # the exact commit, never a branch
path: packages/flutter
Create cargokit_options.yaml in your app's root with:
use_precompiled_binaries: false # build from the pinned source; never download Breez's binary
Then flutter pub get && flutter build apk --release (or appbundle). The first build compiles Rust for each Android ABI
and takes a long time. The package supports Android Gradle Plugin 8.x and 9 (the fork contains the fix for Gradle 9).
4.3 iOS (Flutter)
Requirements: a Mac with Xcode, CocoaPods, Rust installed through rustup. The pod targets iOS 13 or newer and builds the
Rust library in a script phase (cargokit/build_pod.sh). Use the same pubspec.yaml dependency and the same
cargokit_options.yaml as on Android, then:
flutter pub get
cd ios && pod install && cd ..
flutter build ios --release # or build from Xcode
If the build asks for a Rust target, add it with rustup target add aarch64-apple-ios (and aarch64-apple-ios-sim,
x86_64-apple-ios for the simulator). Test a real receive and a real send on a device before you ship. If this path fails,
tell IBIRAPAY with the full error.
4.4 Native Swift or Kotlin (without Flutter)
The fork has UniFFI bindings (crates/breez-sdk/bindings). Its Makefile has bindings-swift, package-xcframework
(iOS and macOS), bindings-kotlin and build-android (needs the Android NDK). Build from the same pinned commit and use
the same configuration JSON (section 5).