Skip to content

Hu-Wentao/flowr

Repository files navigation

FlowR MonoRepo


A predictable state management library that helps implement the BLoC design pattern.

Package Desc Pub
flowr_dart Base FlowR library for pure Dart. Core logic for state and concurrency. pub package
flowr MVVM State Management for Flutter. Adds FrViewModel, FrView, and Providers. pub package
fr_mvvm_env Environment management (Dev/Staging/Prod) with built-in Dropdown UI. pub package
fr_mvvm_locale Localization management with built-in Switch UI and easy context extensions. pub package
fr_mvvm_theme Theme switching with ThemeExtension helpers, image scheme parsing, and JSON color conversion. pub package
fr_mvvm_user User session/profile management with built-in Dropdown UI. pub package

Recommended Packages

Package Desc Pub
efficient_dio_logger Dio interceptor for large-request projects with single-line JSON logging and automatic truncation for oversized values. pub package
drift_duckdb A drift database implementation for DuckDB, allowing you to use DuckDB as a backend for drift. pub package

Agent Skills

This repository ships local agent skills for FlowR Dart usage, Flutter MVVM usage, and contract-first MVVM page scaffolding. See skills/README.md for the available skills and usage examples.


Quick Start (FlowR)

dart pub add flowr

Basic Usage

class CounterModel {
  final int value;
  const CounterModel(this.value);

  CounterModel copyWith({int? value}) => CounterModel(value ?? this.value);
}

class CounterViewModel extends FrViewModel<CounterModel> {
  CounterViewModel() : super(const CounterModel(0));

  void increment() => update((old) => old.copyWith(value: old.value + 1));
}

final counterVm = CounterViewModel();

FrStreamBuilder(
  vm: counterVm,
  stream: (vm) => vm.stream,
  builder: (context, snapshot) {
    final value = snapshot.data?.value ?? 0;
    return Column(
      children: [
        Text('$value'),
        ElevatedButton(
          onPressed: counterVm.increment,
          child: const Text('Increment'),
        ),
      ],
    );
  },
);

Runnable example: main_mvvm.dart

fvm flutter run examples/example/lib/main_mvvm.dart

Advanced Usage

About

FlowR: state management package for the MVVM pattern based on reactive programming.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors