How should I return the pointer from rust for create Uint8List in flutter? #1866
-
Problem:
pub async fn get_cache(&self, key: String) -> *const u8 {
self.cache.get(&key).unwrap().as_ptr()
} final vecPointerFromRust = getCache("key") ; // Can't get pointer address Pointer<Uint8>, it's opaque type.
pointer = Pointer.fromAddress(vecPointerFromRust);
Uint8List image = pointer.asTypedList(length); |
Beta Was this translation helpful? Give feedback.
Answered by
fzyzcjy
Apr 8, 2024
Replies: 1 comment 2 replies
-
If you are confident about this (operating on raw pointers can be quite dangerous!), feel free to convert |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
brandon3343
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you are confident about this (operating on raw pointers can be quite dangerous!), feel free to convert
*const u8
into ani64
(int
), since it is nothing but an address.