没什么好解释的,直接上代码
val bytesAvatar = Base64.decode(base64src, Base64.DEFAULT)
val avator = if(bytesAvatar.isNotEmpty()){
ImageRequest.Builder(context)
.data(bytesAvatar)
.build()
}else{
null
}
avator?.let{
Image(
painter= rememberAsyncImagePainter(it),
contentDescription = "avatar preview",
modifier = Modifier.size(500.dp)
)
}