feat: add #[frb(sync)] to RustState::new for synchronous initialization#3003
feat: add #[frb(sync)] to RustState::new for synchronous initialization#3003guoyu07 wants to merge 1 commit intofzyzcjy:masterfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a Dart analyzer diagnostic that occurred when attempting to tear off a generative constructor of an abstract class, specifically Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces the #[frb(sync)] attribute to the RustState::new function. This change correctly configures the code generator to produce a synchronous Dart function for state initialization, resolving a tearoff_of_generative_constructor_of_abstract_class error in the Dart UI code. The change is appropriate and effectively addresses the issue.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3003 +/- ##
=======================================
Coverage 98.57% 98.57%
=======================================
Files 464 464
Lines 19202 19202
=======================================
Hits 18928 18928
Misses 274 274 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Great job! But a bit confused: it seems it is already sync by default. could you please check a bit about your config yaml |
|
(replied in #3004) |

Fix “tearoff_of_generative_constructor_of_abstract_class” in
rust_ui_counterChanges
Fixes error in frb_example/rust_ui_counter/ui/lib/main.dart
Details about the 'tearoff_of_generative_constructor_of_abstract_class' diagnostic produced by the Dart analyzer.
To resolve this, when added this
#[frb(sync)]attribute topub fn new() -> Self, the generated wrapper class in Dart, allows us to use its constructor tear‑off safely.Version