Skip to content

How to reference flutter assets in Rust code #526

Answered by fzyzcjy
beetee17 asked this question in Q&A
Discussion options

You must be logged in to vote

At least for android, if I remember correctly, the "asset" files are not really a real file in disk but somehow part inside the apk file.

Method 1: https://stackoverflow.com/questions/27140634/how-to-embed-resources-in-rust-executable Then the model is within your .so and you can use it like a u8 array.

Method 2: Let Flutter manage it. Look at flutter doc to see how to manage an "asset". You may need a few lines of flutter code to copy the asset to, say, temporary folder, before rust can see it.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@beetee17
Comment options

@beetee17
Comment options

@fzyzcjy
Comment options

@fzyzcjy
Comment options

@beetee17
Comment options

Answer selected by fzyzcjy
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