-
Notifications
You must be signed in to change notification settings - Fork 45
Migrate flutter_rust_bridge from v1 to v2 #1224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR migrates the Flutter Rust Bridge integration from v1 to v2 by cleaning up old v1 artifacts, introducing a YAML config for codegen, and updating generated bindings and imports throughout the Dart and Rust layers.
- Updated Dart package settings and dependencies for FRB v2 in
pubspec.yaml
- Switched FRB codegen to use
flutter_rust_bridge.yaml
and updated the Makefile - Renamed and re-exported new v2-generated modules, and adjusted Rust bindings
Reviewed Changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
libs/sdk-flutter/pubspec.yaml | Bumped FRB version, reorganized deps/env, added publish settings |
libs/sdk-flutter/flutter_rust_bridge.yaml | New codegen configuration for FRB v2 |
libs/sdk-flutter/makefile | Changed codegen command to generate , output folder |
libs/sdk-flutter/lib/native_toolkit.dart | Updated library loader to use ExternalLibrary API |
libs/sdk-flutter/lib/sdk.dart | Re-exported new v2-generated Dart binding files |
libs/sdk-core/src/lib.rs | Renamed generated module to frb_generated |
libs/sdk-core/src/binding.rs | Updated imports, error mappings, and listener setup |
Comments suppressed due to low confidence (4)
libs/sdk-flutter/lib/native_toolkit.dart:10
- [nitpick] The function name
createLibraryImpl
is ambiguous; consider renaming it to something likeloadExternalLibrary
orgetExternalLibrary
for clarity.
ExternalLibrary createLibraryImpl() {
libs/sdk-flutter/makefile:14
- [nitpick] Consider adding
flutter_rust_bridge
to the.PHONY
target list to ensure it’s always treated as a phony target and avoid conflicts with files of the same name.
flutter_rust_bridge:
libs/sdk-flutter/lib/native_toolkit.dart:8
- Verify that
breez_sdkFFI
matches the actual iOS framework name; if the framework target has a different name (e.g.,breez_sdk_bindings
), this will fail to load.
const _iosLibName = "breez_sdkFFI";
libs/sdk-core/src/binding.rs:30
- You’ve added a
map_err
reference toLnUrlAuthError
but not imported it; addLnUrlAuthError
to this import list to avoid unresolved type errors.
use sdk_common::prelude::{LnUrlPayError, LnUrlWithdrawError};
ad56fa5
to
b35a9c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Did you consider migrating to an instance/async approach like in Nodeless also? (edit: just read bare minimum and maybe best not to make too many breaking changes)
This PR addresses the bare minimum requirements to migrate
flutter_rust_bridge
from v1 to v2.Changelist:
flutter_rust_bridge.yaml
configuration fileBreaking changes:
u64
fields are now generated asBigInt
instead ofint
to prevent precision loss:BigInt.from(num)
when assigning.toInt()
to cast back toint
.import 'package:breez_sdk/bridge_generated.dart'
import 'package:breez_sdk/sdk.dart'
Test Build Runs on C-Breez: