Skip to content

how to use call dart from rust with my argument? #1931

Closed Answered by Sherlock-Holo
Sherlock-Holo asked this question in Q&A
Discussion options

You must be logged in to vote

oh I misunderstood the example

I thought

rustFunction(dartCallback: (name) => 'Hello, $name!');

meant dart provide a ffi function directly, like

fn my_rust_function(a: String) -> String { a.repeat(2) }

but actually: rust provide a function that allow dart call rust function to pass a callback to rust side, then rust can store the callback, and invoke the callback later to achieve the purpose of calling the dart codes

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Sherlock-Holo
Comment options

Answer selected by Sherlock-Holo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants