Skip to content

Conversation

erdemyerebasmaz
Copy link
Contributor

@erdemyerebasmaz erdemyerebasmaz commented Jun 4, 2025

This PR addresses the bare minimum requirements to migrate flutter_rust_bridge from v1 to v2.

Changelist:

  • Cleaned up frb v1 files
  • Config settings are now read from flutter_rust_bridge.yaml configuration file

Breaking changes:

  • u64 fields are now generated as BigInt instead of int to prevent precision loss:
    • Use BigInt.from(num) when assigning.
    • Use .toInt() to cast back to int.
  • Updated import path for SDK bindings:
    • Old: import 'package:breez_sdk/bridge_generated.dart'
    • New: import 'package:breez_sdk/sdk.dart'

Test Build Runs on C-Breez:

@erdemyerebasmaz erdemyerebasmaz added high priority dependencies Pull requests that update a dependency file flutter_rust_bridge labels Jun 4, 2025
@erdemyerebasmaz erdemyerebasmaz added this to the 1.0.0 milestone Jun 4, 2025
Copy link

@Copilot Copilot AI left a 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 like loadExternalLibrary or getExternalLibrary 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 to LnUrlAuthError but not imported it; add LnUrlAuthError to this import list to avoid unresolved type errors.
use sdk_common::prelude::{LnUrlPayError, LnUrlWithdrawError};

@erdemyerebasmaz erdemyerebasmaz force-pushed the frb_v2 branch 4 times, most recently from ad56fa5 to b35a9c8 Compare June 5, 2025 13:39
Copy link
Member

@roeierez roeierez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Copy link
Collaborator

@dangeross dangeross left a 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)

@erdemyerebasmaz erdemyerebasmaz merged commit 99a0ef3 into main Jun 10, 2025
11 checks passed
@erdemyerebasmaz erdemyerebasmaz deleted the frb_v2 branch June 10, 2025 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file flutter_rust_bridge high priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants