flowr_dart 2.11.1
flowr_dart: ^2.11.1 copied to clipboard
Base FlowR library for pure Dart
FlowR Dart #
State management based on Reactive programming for pure dart.
install #
dart pub add flowr_dart
Tip
If you are using Flutter, it is highly recommended to use the flowr package, which provides MVVM support and Flutter-specific features.
Getting started #
Usage #
class Counter extends FlowR<int> {
@override
final int initValue;
Counter({required this.initValue});
/// [update] is powerful:
/// - Automatic state management (ValueStream)
/// - Error handling (runCatching)
/// - Concurrency control (debounce, throttle, mutex)
incrementCounter() => update((old) {
logger('incrementCounter: $old');
return old + 1;
});
}
main() async {
final counter = Counter(initValue: 0);
await counter.incrementCounter();
print('counter: ${counter.value}');
}
Run example: #
Demo FlowR: for dart main.dart
# From workspace root
dart run examples/example/lib/main.dart