Andy Himberger
11/02/2021, 12:29 AM@Composable
fun loadNetworkImage(
url: String,
imageRepository: ImageRepository
): State<Result<Image>> {
// Creates a State<T> with Result.Loading as initial value
// If either `url` or `imageRepository` changes, the running producer
// will cancel and will be re-launched with the new keys.
return produceState(initialValue = Result.Loading, url, imageRepository) {
Kevin Aude
11/02/2021, 8:51 AMAndy Himberger
11/02/2021, 8:03 PM