Skip to content
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

Minor versions do not support backwards compatibility #2479

Open
MatthewLM opened this issue Jan 3, 2025 · 3 comments
Open

Minor versions do not support backwards compatibility #2479

MatthewLM opened this issue Jan 3, 2025 · 3 comments
Labels
awaiting Waiting for responses, PR, further discussions, upstream release, etc bug Something isn't working

Comments

@MatthewLM
Copy link

Describe the bug

If the package version is specified using a caret in pubspec.yaml and the minor version is updated, an error will be produced similar to:

Bad state: flutter_rust_bridge's codegen version (2.6.0) should be the same as runtime version (2.7.0)

Minor version numbers should allow backwards compatibility if semantic versioning is followed.

Steps to reproduce

Self evident

Logs

No need for logs

Expected behavior

No response

Generated binding code

No response

OS

No response

Version of flutter_rust_bridge_codegen

No response

Flutter info

No response

Version of clang++

No response

Additional context

No response

@MatthewLM MatthewLM added the bug Something isn't working label Jan 3, 2025
@fzyzcjy
Copy link
Owner

fzyzcjy commented Jan 3, 2025

It supports backward compatibility in the sense that, the user code should be able to run when upgrading from 2.6.0 to 2.7.0 without issues.

For your question, it is that you need to keep Rust flutter_rust_bridge in sync with Dart flutter_rust_bridge version. This is usually automatically done when running flutter_rust_bridge_codegen.

@fzyzcjy fzyzcjy added the awaiting Waiting for responses, PR, further discussions, upstream release, etc label Jan 3, 2025
@MatthewLM
Copy link
Author

I have library A that uses flutter_rust_bridge and produces a Rust binary with the codegen. I have library B that takes the binary and includes library A as a package in the pubspec.

The problem occurred when doing a dart pub upgrade for library B. The Rust binary was not updated, but the Dart flutter_rust_bridge package was. This caused library B to break. Library A cannot be expected to always keep up-to-date with flutter_rust_bridge with a new binary, so there will be a mismatch.

@fzyzcjy
Copy link
Owner

fzyzcjy commented Jan 11, 2025

Totally agree that would be an issue. However, the cost to ensure different dart frb version is compatible with different rust frb version seems nontrivial, because this requires all internal implementation details change in a compatible way. What about using things like flutter_rust_bridge: 2.7.0 instead of ^2.7.0, does it disable dart pub upgrade from changing it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting Waiting for responses, PR, further discussions, upstream release, etc bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants