Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在构建一个插件,需要使用图像(如 Image.asset 或 Image.file),并且需要将它们传递给我的原生插件。但是,我找不到一个体面的方法来通过这些。有谁知道如何实现这一目标以及这些对象通常如何在本地使用?
您可以传递资产路径并通过 Flutter 读取它:
MethodChannel
AssetManager assetManager = registrar.context().getAssets(); String key = registrar.lookupKeyForAsset("icons/heart.png"); AssetFileDescriptor fd = assetManager.openFd(key);
颤振文档