Skip to content

Fluxy is a Flux architecture implementation written in Kotlin.

License

Notifications You must be signed in to change notification settings

hoop-carpool/fluxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Daniel Sanchez Ceinos
Jan 28, 2022
d16bbe3 · Jan 28, 2022

History

29 Commits
Oct 3, 2020
Jan 28, 2022
Jan 28, 2022
Jan 28, 2022
Feb 23, 2020
Jan 28, 2022
Jan 28, 2022
Oct 3, 2020
Jan 11, 2020
Mar 28, 2020
Jan 28, 2022
Jan 11, 2020
Jan 11, 2020
Jan 11, 2020
Nov 11, 2020

Repository files navigation

Fluxy

What it's all about

Fluxy its a flow arquitecture implementation.

Why flux?

  • Single information flow
  • Single source of truth
  • Reactivity

Where this implementation comes from

This library its created from https://github.com/minikorp/mini

But with a few diferences:

  • Full courroutines implementation
  • 0 auto gen code
  • Easy to understand the core logic

Components

Dispatcher : each time an action was dispatched give it to proper stores.

val dispatcher = Dispatcher()
dispatcher.dispatch(MyAction())

State : represents an immutable state of an application.

data class MyState(val number: String = "")

Action : define a use case, can be synchronous or an asynchronous operation

data class MyAction(val number: String) : BaseAction

Store : is a hoder for a state and has Reducer functions.

class MyStore : FluxyStore<MyState>() {

    init {
        reduce<MyAction> {
            state.copy(number = it.number)
        }
    }
}

Reducer is a pure function that takes an action and current state returning a new state.

How to install

allprojects {
    repositories {
    	maven { url "https://jitpack.io" }
    }
}
dependencies {
    implementation "com.github.hoop-carpool.fluxy:fluxy:x.y.z"  
    implementation "com.github.hoop-carpool.fluxy:timberlogger:x.y.z" // Optional default logger implementation using Timber
}