How do i load image from drawable folder in Jetpack Compose?

In Jetpack compose example to load image from drawable folder we will use below code.

@Composable
fun LoadFromResourceDemo(){
    val image: Painter = painterResource(id = R.drawable.image1)
    Image(painter = image,contentDescription = "image",)
}

 

In the above example we used image composable and create Painter object from painterResource() and pass the resource id.

You can read more about Image composable in Jetpack compose 


Flutter Questions
Android Questions