Kotlin Flow for Android: Getting Started | raywenderlich.com

In this tutorial, you’ll learn about the basics of Kotlin Flow, and you’ll build an Android app that fetches weather forecast data using Flow.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/9799571-kotlin-flow-for-android-getting-started

Hi Dean,

Thanks for writing such a beautiful App to explain Kotin flow. Could you please some resources to write the Android Test for Flow and Coroutines (for ViewModel and Repository layer).

Thanks,
Pardeep Sharma.

I can’t seem to get any outputs in Android Studio 4.2.1 when I run the main function.

Here are some resources to test flow

continuing


finally 


Same problem, hitting play on the main function does nothing.

Only solution I could find is Installing IntelliJ IDEA Community instead.
Open the project in that then I get an error about JDK configuration and click the Use settings JDK. The main.kt file is under src->main->kotlin and now the Play button works.

I have a few questions in understanding Kotlin flows. Please help me clarify these things:

  1. If we don’t have to send multiple values(in case we only use REST APIs), in that case what is the advantage of using Kotlin flows?
  2. Is the API used in the app a streaming API?
  3. If so, how is the data sent from the API whenever there is a change received in the app?
  4. How do we generally integrate streaming APIs in an android app if we use/don’t use Kotlin flows?

The tutorial was great and insightful. However, it seems the metaweather API is no longer accessible or available. Just a piece of side information.