home/language/migrate-livedata-to-stateflow

Migrate Livedata to Stateflow

GPTClaudeGemini··158 copies·updated 2026-07-14
migrate-livedata-to-stateflow.prompt
<!--
  When to use:
  You have an existing ViewModel that uses LiveData / MutableLiveData and you want to
  migrate it to the MVI pattern using StateFlow, a State data class, Action sealed
  interface, and Event channel. Use this prompt to perform the migration safely.

  Skills activated:
  android-presentation-mvi, android-coroutines-flow, android-testing

  Fill in every [PLACEHOLDER] before pasting.
-->

# Migrate ViewModel from LiveData to StateFlow + MVI

Follow **android-presentation-mvi** and **android-coroutines-flow** exactly.

## ViewModel to migrate
- ViewModel class: `[VIEWMODEL_NAME]` (e.g. `DashboardViewModel`)
- Module / file path: `[FILE_PATH]`
- Current LiveData fields: `[LIVEDATA_FIELDS]`
  (e.g. `val articles: LiveData<List<Article>>`, `val isLoading: LiveData<Boolean>`)
- Current observer sites (fragments/activities): `[OBSERVER_SITES]`
  (e.g. `DashboardFragment`, `MainActivity`)

## Paste the existing ViewModel source below

when to use it

Community prompt sourced from the open-source GitHub repo Shekhar23/claude-zero-to-hero-android-KMP (no explicit license). A "Migrate Livedata to Stateflow" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.

tags

languagecommunitygeneral

source

Shekhar23/claude-zero-to-hero-android-KMP · no explicit license