2

Hey everyone,

I'm currently exploring Kotlin Compose for WebAssembly (WASM) and I'm trying to figure out how to load images from the internet within my Compose application. I've been searching through the documentation and various resources, but I haven't found a clear solution yet.

Here's what I'm trying to achieve:

I want to dynamically load images from URLs and display them within my Kotlin Compose WASM application. I've tried using the Image component in Compose, but it seems to only support local resources or resources bundled within the application. Is there a way to fetch and display images from URLs directly?

My specific questions are:

  1. Is it currently possible to load images from the internet in Kotlin Compose WASM?
  2. If so, what are the recommended approaches or libraries to achieve this?
  3. Are there any examples or tutorials available that demonstrate how to implement this functionality?

Any help or guidance on this matter would be greatly appreciated! Thanks in advance.

1
  • 1
    I think Coil should not only work for Android, it also has Kotlin Multiplatform support and therefore should probably also work for projects targeting WASM. It has at least some experimental support. But since Kotlin targeting WASM is alpha anyways, that's probably the best you can hope for. Commented Apr 28, 2024 at 21:47

1 Answer 1

0

Yes, starting with Coil 3 (alpha), loading internet images in Kotlin Compose for WASM is supported!

You can use AsyncImage just like on Android

Sign up to request clarification or add additional context in comments.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.