fzyzcjy / flutter_rust_bridge

Flutter/Dart <-> Rust binding generator, feature-rich, but seamless and simple.
https://fzyzcjy.github.io/flutter_rust_bridge/
MIT License
4.29k stars 301 forks source link

rust_input version specification #2311

Open poborin opened 1 month ago

poborin commented 1 month ago

I have a project that uses tungstenite. There are a few dependencies that are using different versions: tungstenite@0.20.1 tungstenite@0.21.0 tungstenite@0.24.0

When I add a tungstenite crate to a rust_input parameter in flutter_rust_bridge.yaml, the generate command fails with the following error:

There are multiple `tungstenite` packages in your project, and the specification `tungstenite` is ambiguous.
Please re-run this command with one of the following specifications:
  tungstenite@0.20.1
  tungstenite@0.21.0
  tungstenite@0.24.0

Describe the solution you'd like I can specify a version in the flutter_rust_bridge.yaml as such:

rust_input: crate::api, tungstenite@0.24.0
welcome[bot] commented 1 month ago

Hi! Thanks for opening your first issue here! :smile:

fzyzcjy commented 1 month ago

Looks reasonable and feel free to PR for this! (Since this is experimental feature, I may not have a lot of time to handle this soon.)

Btw, briefly looked at https://github.com/snapview/tungstenite-rs, and I guess the syntax may (or may not) be too complex to be auto scanned. Thus, I suggest to firstly create an empty project and try whether frb can handle that package, and if yes, work on the multi-version thing.