declarate 0.0.3
declarate: ^0.0.3 copied to clipboard
Declarate is a lightweight, stateless, and declarative state management library for Flutter. It enables reactive UI updates without State or Bloc, inspired by SwiftUI and declarative architectures. [...]
0.0.1 #
Initial Stable Release — Declarate #
The first public release of Declarate, a lightweight, stateless, and declarative state management library for Flutter.
Declarate introduces a minimal, SwiftUI-inspired approach to managing application logic — without relying on State, Cubit, or Bloc.
Highlights #
-
Introduced Declarate, the base reactive class for managing logic.
- Supports both synchronous and asynchronous mutations via a unified
react()method. - Includes lifecycle hooks:
willEmit()anddidEmit(). - Provides safe disposal and guards against post-dispose updates.
- Supports both synchronous and asynchronous mutations via a unified
-
Added Declarion, a multi-provider for injecting and managing multiple
Declarateinstances.- Simplified dependency access with
Declarion.of<T>(context).
- Simplified dependency access with
-
Added Declarator, a declarative builder and listener for reactive UI updates.
- Supports
builder,listener, andbuildWhenfor fine-grained rebuild control. - Combines the power of
BlocBuilderandBlocListenerinto one minimal widget.
- Supports
-
Unified reactive syntax with a single
react()method:- Works with both synchronous and asynchronous updates automatically.
- Simplifies common patterns like counter updates or data fetches.
Example #
class CounterDeclarate extends Declarate {
int count = 0;
void increment() => react(() => count++);
void loadAsync() => react(() async {
await Future.delayed(const Duration(seconds: 1));
count++;
});
}
Declarion(
viewModels: [CounterDeclarate()],
child: Declarator<CounterDeclarate>(
builder: (context, vm) => Text('Count: ${vm.count}'),
),
);
Technical Improvements #
- Implemented safe disposal tracking using
_disposedflag. - Added lifecycle safety for
emit()andreact(). - Prevented rebuilds after disposal.
- Designed for composability with Declar UI framework and similar declarative architectures.
Philosophy #
Declarate is built on three core principles:
- Simplicity over boilerplate — No
Stateclasses, no verbose patterns. - Declarative reactivity — UIs rebuild automatically on logic change.
- SwiftUI-like design — Minimal syntax with clear lifecycle control.
Repository #
GitHub: https://github.com/updown-interactive/declarate