从原生android访问flutter资源时如何将键字符串转换为可绘制int

问题描述

我正在尝试从我的根文件夹中访问 Flutter 中的图像。

在根文件夹中,我有

assets
    test.jpeg

我也包含在我的 pubspec.yaml

Flutter:
assets:
- assets/test.jpeg

现在在我的java代码中,我有这个:

FlutterLoader loader = FlutterInjector.instance().FlutterLoader();
String key = loader.getLookupKeyForAsset("assets/test.jpeg");

现在,基于此:我需要解码以整数作为参数的资源

Bitmap bmp = BitmapFactory.decodeResource(mContext.getResources(),what will I put here...);

在安卓中我可以这样做:

Bitmap bmp = BitmapFactory.decodeResource(mContext.getResources(),R.drawable.test.jpeg);

基于这个答案here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)