flutter_rust_bridge icon indicating copy to clipboard operation
flutter_rust_bridge copied to clipboard

Ignore non-opaque struct fields

Open noomly opened this issue 6 months ago • 2 comments

I was excited to see the support of #[frb(ignore)] for struct fields and was a bit frustrated when I realized it seems not to apply for non opaque structs.

I have some structs that contain types that flutter_rust_bridge isn't able to process (panicking when trying to generate Flutter code), and that in any case shouldn't be exposed to the Flutter side. The current state of affair requires me to create "mirror" struct types excluding any problematic fields so I can pass them to Flutter.

It would be ideal if instead I could simply:

#[frb(non_opaque)]
pub struct CommandResponse {
    pub hello: f64,
    #[frb(ignore)]
    pub world: ProblematicType,
}

Such that frb wont attempt to generate code for ProblematicType and wont include the field world into the generated Flutter class for CommandResponse.

noomly avatar May 28 '25 15:05 noomly

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

welcome[bot] avatar May 28 '25 15:05 welcome[bot]

Hmm, for non-opaque types, if there is an ignored field, it seems that we do not know how to fill the value of it :/

fzyzcjy avatar May 29 '25 02:05 fzyzcjy

Close since inactivity, but if there are any thoughts feel free to discuss!

fzyzcjy avatar Jul 01 '25 14:07 fzyzcjy

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.

github-actions[bot] avatar Jul 15 '25 15:07 github-actions[bot]