-
Notifications
You must be signed in to change notification settings - Fork 301
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
Document has wrong dart syntax on section 4.3.4 #421
Comments
Maybe you have not run /cc @Desdaemon Or is this a real bug |
I followed instruction from 4.3.3,and then run
And the project is based on template from here: https://github.com/Desdaemon/flutter_rust_bridge_template. |
Sounds quite correct. Could you please share your whole (refined) repository, for example, as a github repo so I can look at the modified and generated dart code? |
What I did totally according to official template:
From setp 5, I used the code bleow instead of that stated in section 4.3.4: // replace with this:
final text = platform.when(
//error here,'when' cannot be recognized
// final text = snap.data!.when(//error here,'when' cannot be recognized
ios: () => 'iOS',
windows: () => 'Windows',
android: () => 'Android',
unix: () => 'Unix',
macOs: (arch) => 'MacOS on $arch',
wasm: () => 'the Web',
unknown: () => 'Unknown OS',
);
return Text('$text ($release)', style: style); In addition, since I changed api.rs, Whenever I run
But it is still workable.
Though this warning seems to not harm output, it is still frustrated. |
Sounds like we need to modify the tutorial? /cc @Desdaemon I am willing to review a PR :) |
Sounds like a (or two) different bugs. Could you please raise them separately? |
The example in the tutorial is a bit out of date with the actual template, but otherwise the provided template works on my MacOS machine. I'll have to check this again later on my Windows one. |
For issue on Meanwhile, I made a new template for testing number value between dart and rust with a method called But even it is compiled ,like with u32 or u64, I tested out without expectation, find that users should be careful on the number value parsed between dart and rust. Otherwise, the calculation would either be stackoverflow or cutted. And range of Int from official dart documentation is not clear--- I am not sure whether it is in range [ -2^53,-2^53] or [ -2^63, 2^63]. |
If I remember correctly: 53 for web, 64 for others |
For other problems, what about raising separate issues, since those problems are unrelated to the current title - so future readers may be hard to find the information |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue. |
the refined code from this section is not compilable:
error message:
The method 'when' isn't defined for the type 'List'. ...
The text was updated successfully, but these errors were encountered: