Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Play MVI with Kotlin Coroutines Flow | MVI pattern on Android using Kotlin Coroutines Flow | Dagger Hilt DI | Koin DI | SharedFlow | StateFlow | Arrow.kt Android Sample

License

NotificationsYou must be signed in to change notification settings

Kotlin-Android-Open-Source/MVI-Coroutines-Flow

Repository files navigation

MVI-Coroutines-Flow-Clean-Architecture

MVI-Coroutines-Flow-Clean-Architecture-ArrowKt

MVI-Coroutines-Flow-Clean-Architecture-ArrowKt-KoinDI

All Contributors

Build CIUnit Tests CIcodecovQodanaValidate Gradle WrapperAPIKotlinHitsHitsLicense: MITGitter


Liked some of my work? Buy me a coffee (or more likely a beer)

Buy Me A Coffee

Coroutine + Flow = MVI ❤️

  • Play MVI with Kotlin Coroutines Flow.
  • Multiple modules, Clean Architecture, Functional programming withΛRROW.kt.
  • Unit tests for MVI ViewModel, domain and data layer.
  • Master branch using Koin for DI.
  • Checkoutdagger_hilt branch, using Dagger Hilt for DI (obsolete, will update as soon as possible).
  • Download latest debug APK here.

More

1. Jetpack Compose Version

👉https://github.com/Kotlin-Android-Open-Source/Jetpack-Compose-MVI-Coroutines-Flow

2. Pagination Horizontal List in Vertical List

👉https://github.com/Kotlin-Android-Open-Source/Pagination-MVI-Flow

Light theme

List view stateError view state
Add new userSearch user

Dark theme

List view stateError view state
Add new userSearch user

MVI pattern

This pattern was specified byAndré Medeiros (Staltz) for a JavaScript framework he has written calledcycle.js. From a theoretical (and mathematical) point of view we could describe Model-View-Intent as follows1

  • intent(): This function takes the input from the user (i.e. UI events, like click events) and translate it to “something” that will be passed as parameter tomodel() function.This could be a simple string to set a value of the model to or more complex data structure like an Object. We could say we have the intention to change the model with an intent.
  • model(): Themodel() function takes the output fromintent() as input to manipulate the Model. The output of this function is a new Model (state changed).So it should not update an already existing Model.We want immutability!We don’t change an already existing Model object instance.We create a new Model according to the changes described by the intent.Please note, that themodel() function is the only piece of your code that is allowed to create a new Model object.Then this new immutable Model is the output of this function.Basically, themodel() function calls our apps business logic (could be an Interactor, Usecase, Repository … whatever pattern / terminology you use in your app) and delivers a new Model object as result.
  • view(): This method takes the model returned frommodel() function and gives it as input to theview() function. Then the View simply displays this Model somehow.view() is basically the same asview.render(model).

Reference

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Petrus Nguyễn Thái Học

💻🚧🤔🎨🐛

This project follows theall-contributors specification. Contributions of any kind welcome!

Footnotes

  1. https://hannesdorfmann.com/android/mosby3-mvi-2/

Sponsor this project

    Packages

    No packages published

    Contributors8

    Languages


    [8]ページ先頭

    ©2009-2025 Movatter.jp