Overview
Add a Flutter/Dart SDK by wrapping the existing core/ crate with a flutter_ffi/ crate using flutter_rust_bridge v2. Ships as a standalone pub.dev plugin package.
Architecture
The core/ crate already has no FFI dependency — no business logic needs to be duplicated.
core/ ← unchanged, pure Rust (attribution, identify, deferred deep links)
ffi/ ← UniFFI → Swift + Kotlin (existing native iOS/Android)
flutter_ffi/ ← flutter_rust_bridge → Dart (new)
Key work
1. client/mobile/flutter_ffi/ crate
- Depends on
rift_sdk_core
- Mirrors the
ffi/ public API surface using #[frb] annotations
- Replicate all public methods:
attributeLink, setUserId, checkDeferredDeepLink, pendingPresentation, dismissPresentation, showPresentation, etc.
2. RiftStorage equivalent for Dart
UniFFI's foreign trait pattern doesn't exist in flutter_rust_bridge. Instead, accept storage callbacks at init time backed by shared_preferences on the Dart side:
pub struct FlutterStorage {
get: Arc<dyn Fn(String) -> Option<String> + Send + Sync>,
set: Arc<dyn Fn(String, String) + Send + Sync>,
remove: Arc<dyn Fn(String) + Send + Sync>,
}
final sdk = await RiftSdk.init(
publishableKey: 'pk_live_...',
storage: RiftStorage(
get: (key) => prefs.getString(key),
set: (key, val) => prefs.setString(key, val),
remove: (key) => prefs.remove(key),
),
);
3. Flutter plugin package
flutter_rust_bridge_codegen generate produces Dart bindings
- Plugin bundles compiled
.so (Android) and .a (iOS) from the same Rust workspace
- Publish to pub.dev
4. CI
- Add Flutter build steps to
sdk-ci.yml and sdk-release.yml alongside existing UniFFI bindgen
- Triggered by
sdk/flutter/ path changes
Out of scope
- Native iOS/Android SDK changes (UniFFI path unchanged)
- Any new business logic — all logic stays in
core/
Overview
Add a Flutter/Dart SDK by wrapping the existing
core/crate with aflutter_ffi/crate using flutter_rust_bridge v2. Ships as a standalone pub.dev plugin package.Architecture
The
core/crate already has no FFI dependency — no business logic needs to be duplicated.Key work
1.
client/mobile/flutter_ffi/craterift_sdk_coreffi/public API surface using#[frb]annotationsattributeLink,setUserId,checkDeferredDeepLink,pendingPresentation,dismissPresentation,showPresentation, etc.2. RiftStorage equivalent for Dart
UniFFI's foreign trait pattern doesn't exist in flutter_rust_bridge. Instead, accept storage callbacks at init time backed by
shared_preferenceson the Dart side:3. Flutter plugin package
flutter_rust_bridge_codegen generateproduces Dart bindings.so(Android) and.a(iOS) from the same Rust workspace4. CI
sdk-ci.ymlandsdk-release.ymlalongside existing UniFFI bindgensdk/flutter/path changesOut of scope
core/