79266762

Date: 2024-12-10 00:43:33
Score: 1.5
Natty:
Report link

This worked:

@Composable()
fun IconImage(modifier: GlanceModifier = GlanceModifier) {
    val assetPath : String = "assets/test.png"
    val loader = FlutterInjector.instance().flutterLoader()
    val assetLookupKey = loader.getLookupKeyForAsset(assetPath)
    val inputStream: InputStream = LocalContext.current.assets.open(assetLookupKey)
    val bitmap = BitmapFactory.decodeStream(inputStream)
    Image(
      ImageProvider(bitmap), modifier = modifier, contentDescription = null
    )
}
Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Dario Digregorio