piper_state 0.1.0
piper_state: ^0.1.0 copied to clipboard
Simple Flutter state management with lifecycle-aware ViewModels. Automatic cleanup, explicit dependencies, no boilerplate.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[Unreleased] #
0.1.0 - 2026-07-23 #
Added #
computed()/Computed<T>— derived state that recomputes automatically when its dependencies change, with configurableequalsand cycle detection.- Automatic dependency tracking (
PiperTracker,Trackable): readingStateHolder.valueinside a tracked scope subscribes the reader. - Configurable
equalsonStateHolder,state(), andcomputed(). AsyncError.from()andAsyncStateHolder.setErrorFrom()— preserve the original error object and stack trace instead of collapsing to a string.TaskCancellationTokenwithwait(),onCancel(), andthrowIfCancelled()for cooperative task cancellation.
Changed #
launch()andlaunchWith()now receive aTaskCancellationToken. This is a breaking callback-signature change.launchWith()andload()now return theirTaskhandles.- Cancelled task results settle immediately instead of waiting for the underlying Future to finish.
- Notifications are batched so derived state settles before listeners fire (glitch-free updates across diamond dependency graphs).
Removed #
reload()— useload().AsyncState.lift()— usewhen().
0.0.1 - 2025-12-08 #
Added #
StateHolder<T>— synchronous state with change notificationAsyncStateHolder<T>— async state with loading/error/data handlingAsyncState<T>— sealed class for representing async operation statesViewModel— lifecycle-aware base class with automatic cleanupTask— cancellable async operationsTaskScope— manages multiple tasks with collective cancellation- Stream bindings:
bind(),stateFrom(),bindAsync() load()andlaunchWith()helpers for async operationsTestScopefor testing ViewModels without Flutter