piper_state 0.1.0 copy "piper_state: ^0.1.0" to clipboard
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 configurable equals and cycle detection.
  • Automatic dependency tracking (PiperTracker, Trackable): reading StateHolder.value inside a tracked scope subscribes the reader.
  • Configurable equals on StateHolder, state(), and computed().
  • AsyncError.from() and AsyncStateHolder.setErrorFrom() — preserve the original error object and stack trace instead of collapsing to a string.
  • TaskCancellationToken with wait(), onCancel(), and throwIfCancelled() for cooperative task cancellation.

Changed #

  • launch() and launchWith() now receive a TaskCancellationToken. This is a breaking callback-signature change.
  • launchWith() and load() now return their Task handles.
  • 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() — use load().
  • AsyncState.lift() — use when().

0.0.3 - 2025-12-09 #

Changed #

  • Updated SDK constraint to ^3.6.0
  • Updated meta dependency to ^1.11.0

0.0.2 - 2025-12-08 #

Changed #

  • Version bump for flutter_piper compatibility

0.0.1 - 2025-12-08 #

Added #

  • StateHolder<T> — synchronous state with change notification
  • AsyncStateHolder<T> — async state with loading/error/data handling
  • AsyncState<T> — sealed class for representing async operation states
  • ViewModel — lifecycle-aware base class with automatic cleanup
  • Task — cancellable async operations
  • TaskScope — manages multiple tasks with collective cancellation
  • Stream bindings: bind(), stateFrom(), bindAsync()
  • load() and launchWith() helpers for async operations
  • TestScope for testing ViewModels without Flutter
2
likes
160
points
186
downloads

Documentation

Documentation
API reference

Publisher

verified publisherglennso.dev

Weekly Downloads

Simple Flutter state management with lifecycle-aware ViewModels. Automatic cleanup, explicit dependencies, no boilerplate.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#state-management #viewmodel #architecture #dart #flutter

License

MIT (license)

Dependencies

meta

More

Packages that depend on piper_state