We are developing a "image editor" app using Flutter. Thus, we need to (1) show images on the UI, and (2) manipulate images using some algorithms in C/C++.
Flutter does have a FFI between dart and c/c++, but I do not know how to pass big arrays like images (e.g. can be megabytes) efficiently?
Thanks very much!
After experiments, now I have some code (in the production code!) passing around array of 20MB size between C and Dart. It only takes several milliseconds (just a rough estimation, but surely it does not take seconds).
Thus, my answer to my question is: Just do it. Memory copies seems to be quite cheap, and do not worry about it :)
EDIT in 2022:
Flutter does have have "zero copy" array transfer when going from native to Flutter side, via DartCObject. See the "ZeroCopyBuffer" feature in my library https://github.com/fzyzcjy/flutter_rust_bridge for an example of usage.