FnMut unrecognized #2367
FnMut unrecognized
#2367
-
Is FnMut not supported for a callback type? I get the following debug log from generate: [2024-10-23T10:04:44.563Z DEBUG /home/dl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.5.0/src/library/codegen/parser/mir/parser/function/real/mod.rs:114] parse_function see error and skip function: function="rust_function" error=when trying to parse DartFn
Caused by:
Unknown ident: FnMut For the given function: #[frb]
pub async fn rust_function(mut dart_callback: impl FnMut(String) -> DartFnFuture<String>) {
dart_callback("Tom".to_owned()).await; // Will get `Hello, Tom!`
} |
Beta Was this translation helpful? Give feedback.
Answered by
fzyzcjy
Oct 23, 2024
Replies: 1 comment 2 replies
-
Hmm, I wonder why do you need to have FnMut? Since the dart_callback is implemented by frb and by Dart code, I guess always using Fn maybe sufficient. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
jbbjarnason
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hmm, I wonder why do you need to have FnMut? Since the dart_callback is implemented by frb and by Dart code, I guess always using Fn maybe sufficient.