Desdaemon / flutter_rust_bridge_template

Template for Flutter + Rust integration with flutter_rust_bridge.
https://desdaemon.github.io/flutter_rust_bridge_template/
Apache License 2.0
120 stars 63 forks source link

How to use an older version of flutter_rust_bridge for this template? #28

Closed dbsxdbsx closed 1 year ago

dbsxdbsx commented 1 year ago

My platform is win10. I tried to delete both cargo.lock and pubspec.lock, and set flutter_rust_bridge version to an older version in both pubspec.yaml and cargo.toml. Finally, after running just clean && just, it would still producing some .rs files in which there are new struct only exists in the new version.

Then, I found that both cargo.lock and pubspec.lock still automatically generated with the original crate version(currently 1.49.1), which is not what I want.

Inputting flutter_rust_bridge_codegen --version in cmd, it does output the older version. But why finally frb would do the generation with the newer version? Did I miss some settings?

Somehow, this issue is like that one:https://github.com/Desdaemon/flutter_rust_bridge_template/issues/16. But following that doesn't solve my problem.

Desdaemon commented 1 year ago

Inputting flutter_rust_bridge_codegen --version in cmd, it does output the older version. But why finally frb would do the generation with the newer version?

This sounds like you may have multiple copies of the codegen installed. How about removing all instances of flutter_rust_bridge_codegen in .cargo/bin and try installing again?

dbsxdbsx commented 1 year ago

Thanks your answer, after reinstallation, it did solve my issue. But still, after compilation (I've done just clean before), cargo. lock and pubspec.lock would still automatically generate with frb of the latest version (v1.49.1). Do you know where does the information come from?

Desdaemon commented 1 year ago

cargo.lock and pubspec.lock would still automatically generate with frb of the latest version

You will need to pin the exact version of the dependency in Cargo.toml and pubspec.yaml to get the correct one.

dbsxdbsx commented 1 year ago

cargo.lock and pubspec.lock would still automatically generate with frb of the latest version

You will need to pin the exact version of the dependency in Cargo.toml and pubspec.yaml to get the correct one.

I did, like this:

  flutter_rust_bridge: ^1.38.2
[dependencies]
flutter_rust_bridge = "1.38.2"
anyhow = "1"

But the version listed in cargo. lock and pubspec.lock are still the latest version. For this, I guess we misunderstand the 2 files--- The version listed there are indeed the latest compilable version for the crate/packgage themselves, NOT for project using these crates/packages.

Anyway, the issue is solved. Thanks.