I have my kotlin file where I want to access an image, which is outside of android folder, in the root of flutter app.
val imagePath = widgetData.getString("image", null)
if (imagePath != null) {
try {
val fullImagePath = "assets/images/$imagePath"
val assetInputStream = context.assets.open(fullImagePath)
val assetBitmap = BitmapFactory.decodeStream(assetInputStream)
setImageViewBitmap(R.id.backgroundImage, assetBitmap)
} catch (e: IOException) {
Log.e("CustomHomeView", "Error loading image: $e")
}
}
That’s how I want to access it.
But that what I got
Error loading image: java.io.FileNotFoundException: assets/images/fog_drizzle.webp
Any ideas how can I use my flutter image in kotlin CustomHomeView class? Thanks in advance