Flowdux

A lightweight Redux-style state management library for Kotlin Multiplatform and Dart/Flutter with Middleware support.

Kotlin JitPack version Dart pub.dev version Flutter pub.dev version
GitHub Repository Quick Start

Features

Redux Pattern

Predictable state management with Reducer pattern, unidirectional data flow, and immutable state.

Middleware & Strategies

Side effect handling with execution strategies: takeLatest, debounce, throttle, retry, sequential, and strategy chaining.

Remote State Sync

Real-time client-server state synchronization over WebSocket with type-safe shared action contracts.

Time Travel

Undo/redo, state history navigation, and branching for debugging and development.

Kotlin Multiplatform

Runs on JVM, Android, iOS, JavaScript, and WebAssembly. Built on Coroutines and Flow.

Dart & Flutter

Full Dart implementation with Flutter widget bindings and Stream-based reactive state.

Installation

Kotlin (JitPack)

dependencies {
    implementation("com.github.chibimoons:flowdux:1.8.2")
}

Dart / Flutter

dependencies:
  flowdux: ^0.2.3

Quick Start

// Define State and Actions
data class CounterState(val count: Int = 0) : State

sealed class CounterAction : Action {
    object Increment : CounterAction()
    object Decrement : CounterAction()
}

// Create Reducer
val counterReducer = buildReducer<CounterState, CounterAction> {
    on<CounterAction.Increment> { state, _ ->
        state.copy(count = state.count + 1)
    }
}

// Create and Use Store
val store = createStore(
    initialState = CounterState(),
    reducer = counterReducer,
)

store.state.collect { println("Count: ${it.count}") }
store.dispatch(CounterAction.Increment)

Platform Support

PlatformKotlinDart
JVMYes-
AndroidYes-
iOSYes-
JavaScriptYesYes
WebAssemblyYes-
Flutter-Yes

Documentation