I am building a plugin and need to make use of images (like Image.asset or Image.file) and need to pass them to my native plugin. However, I could not find a decent way to pass these. Does anyone know how to achieve that and how these objects are used natively in general?
Asked
Active
Viewed 472 times
1 Answers
2
You can pass the asset path and read it via Flutter:
- Pass the asset path through
MethodChannel
- Look for the asset using it's path:
AssetManager assetManager = registrar.context().getAssets();
String key = registrar.lookupKeyForAsset("icons/heart.png");
AssetFileDescriptor fd = assetManager.openFd(key);

Mahdi-Malv
- 16,677
- 10
- 70
- 117