lazx 2.1.0
lazx: ^2.1.0 copied to clipboard
A state management library based on the ViewModel design pattern for Flutter.
2.1.0 #
New features #
- Stream Operators: Extension methods on
LazxDatathat return read-only derived datadebounced(Duration)— emits value only after a pause in updates (search fields, form validation)throttled(Duration)— limits emission rate (scroll events, rapid taps)distinct([equals])— skips consecutive duplicate values, with optional custom comparator
- LazxDerivedData: Read-only
LazxDatasubclass backing the stream operators. Works as a drop-in replacement in all Lazx builders. Callingpush(),setState(), orreset()throwsUnsupportedError - LazxComputed: Derived reactive values that auto-recompute when any source changes. Supports mixed source types (
LazxData,LazxObserver,LazxState), aggregates state with Error > Loading > Success > Initial priority, and is distinct by default (skips rebuild if computed value unchanged) - Chaining: Operators can be chained (e.g.
query.debounced(...).distinct()) - Testing Helpers (
package:lazx/lazx_testing.dart): Extension methods for async test assertionswaitForState(LxState)— completes when the target state is observedexpectStateSequence(List<LxState>)— strict ordered state sequence checkwaitForValue(T)— completes when the target value is observedexpectEmits(List<T>)— verifies a sequence of emitted values
2.0.0 #
Breaking changes #
- LazxObserver:
observergetter renamed tostream(aligns withLazxData.stream) - LazxObserver:
set()renamed topush()(aligns withLazxData.push()) - LazxDisposable: New base class for all Lazx reactive types — both
LazxObservableandLazxObserverimplement it - LazxViewModel.props: Type changed from
List<LazxObservable>toList<LazxDisposable>— can now hold any Lazx reactive type - LazxManager.props: Type changed from
List<LazxObserver>toList<LazxDisposable>— unified with ViewModel
New features #
- LazxData.reset(): Restores value and state to their initial values
- Lifecycle hooks:
LazxViewModel.onResume()andonPause()— automatically called when the app goes to foreground/background viaLazxView'sWidgetsBindingObserver - LazxViewModel.isDisposed: Tracks whether the ViewModel has been disposed — useful to guard async callbacks
- LazxExecutor mixin: Opt-in
execute<T>(task, {silent})with automaticisLoading/errormanagement. Addwith LazxExecutorand spread...executorPropsinto your props list - Typed LazxMultiBuilder:
LazxMultiBuilder2throughLazxMultiBuilder5— type-safe variants that provide typed values directly in the builder callback instead ofList<dynamic>
Bug fixes #
- LazxStateBuilder, LazxDataBuilder, LazxWidget: Fix stream subscription leaks — subscriptions are now stored and canceled on dispose
- LazxDataBuilder: Add missing
mountedguard beforesetState() - LazxObserverBuilder: Rewrite as StatefulWidget — was previously calling
.listen()insidebuild(), leaking a new subscription on every rebuild - LazxListener: Add
dispose()method to cancel the stream subscription - LazxApp: Register
WidgetsBindingObserverwithaddObserver/removeObserver— lifecycle callbacks (including manager disposal on app detach) were previously dead code
1.1.6 #
- Update SDK constraint to >=3.5.0 <4.0.0
- Update Flutter constraint to >=3.24.0
- Update provider to ^6.1.5
- Remove explicit meta dependency (use Flutter SDK's version)
- Update demo projects SDK constraints
1.1.5 #
- Upgrade all libs versions
- Add a new widget: LazxMultiBuilder
- Upgrade & Update demos with the new widget
- Update README with the new components
1.1.4 #
- Upgrade all libs versions + Demos
1.1.3 #
- Upgrade all libs versions
1.1.2 #
- Downgrade version of rxdart to support graphql lib
1.1.1 #
- Update README with the new components
- Add link for the new demo, Lazx Weather
1.1.0 #
- Add Lazx App Widget + Tests
- Add Lazx Listener + Tests
- Add Lazx State + Tests
- Add Lazx Observer + Tests
- Add Lazx Response + Tests
- Add Lazx Observable
1.0.1 #
- Add example main.dart + demos folder
1.0.0 #
- Initial release