Skip to content

An example how to use a reactive way of data loading inside your view models, while consuming the data from a Composable view.

Notifications You must be signed in to change notification settings

joost-klitsie/DataLoadingExample

Repository files navigation

This is example code to showcase a reactive aproach to load data into a View Model.

The full article can be found on Medium

If you run the project, you will see a screen that can:

  1. Load data from memory directly if it is there
  2. Load data from another source if data is not available in memory
  3. Offer retry mechanism if data fails to load
  4. After data successfully is loaded, updates to the data will populate the screen
  5. You can refresh data by pushing a button
  6. If refreshing data fails, you are informed.

In the example project loading of data is randomized, giving you a 50/50 chance of successfully loading data. In the following GIF's you will see the behavior described above:

loaded_at_start-ezgif com-video-to-gif-converter loading_success-ezgif com-video-to-gif-converter loading_with_failure-ezgif com-video-to-gif-converter

About

An example how to use a reactive way of data loading inside your view models, while consuming the data from a Composable view.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages