mastro 1.5.1
mastro: ^1.5.1 copied to clipboard
A robust state management solution for Flutter that seamlessly integrates reactive programming with event handling and persistence capabilities.
1.5.1 #
- Minor bug fixes and improvements.
- README overhaul with clearer structure and richer explanations.
1.5.0 #
Breaking changes #
- Boxes
dispose()→cleanup()— Replace anydispose()overrides withcleanup()(callsuper.cleanup()inside).- New Callbacks mechanism:
Old:Callbacks({'action': ({data}) { ... }})
New:Callbacks.on('action', (data) { ... }).on(...).on(...)
- Initialization
MastroInit.init()is no longer available — usePersistro.initialize()for persistence setup.
Added #
- Providers: new flags
autoCleanupWhenUnmountedFromWidgetTreeautoCleanupWhenAllViewsDetached
Behavior unchanged — both control whencleanup()is called automatically.
- Late state support:
.late()for uninitialized state on bothLightroandMastro, with helpers:isInitialized,ensureInitialized(),when(...),resetToUninitialized(). - AsyncState: new
AsyncState<T>class for predefined async states (initial,loading,data,error), with.lightro/.mastrowrappers for reactive binding in UI. - MastroBox: new
autoCleanupWhenAllViewsDetached,onViewAttached, andonViewDetachedhooks. - Awaitable sequential events: each queued
execute()inEventRunningMode.sequentialnow returns aFuturethat completes when that specific queued item finishes (per-type FIFO preserved). - Rebuild utilities: added
RebuildBoundaryhelper to force subtree rebuilds via aUniqueKey. - ClassProvider.onDispose: allows running custom cleanup logic when a provided class instance is disposed.
- StaticWidgetProvider: new provider type for supplying static widget instances in the tree without rebuilds.
- Docs: new README with feature-based structure, Lightro vs Mastro comparison, AsyncState, local vs scoped boxes, lifecycle hooks, and
MastroScopeguidance.
Changed #
- Local boxes in views: recommended pattern is to pass a new box through the
MastroViewsuper constructor (commonly via a small factory/closure), while scoped boxes are provided viaBoxProvider/MultiBoxProvider. - Validation & observers (Mastro): clarified usage; validators can gate assignments and run
onValidationError.
Improvements #
- Performance improvements in event execution and builder notifications.
- Builders responsiveness
MastroBuilderandTagBuildernow perform immediate rebuilds when safe (idle / transient / mid-frame) and defer with post-frame coalescing only during build/layout/paint.- Internal defer tokens prevent stale callbacks, avoiding jank with fast gestures.
TagBuilderhot-swap safety: re-attaches whenboxchanges indidUpdateWidget.- Logging: state changes are now logged for easier debugging and tracking.
- Error handling: improved error messages for validation failures and runtime exceptions.
- Persistro: improved initialization flow and persistence operations; now initialized explicitly via
Persistro.initialize()and supports more reliable state restoration and storage.
1.0.2 #
- Minor fixes and improvements.
1.0.1 #
- Minor fixes and improvements.
- Updated documentation.
1.0.0+3 #
- Updated documentation.
1.0.0+2 #
- Updated documentation.
1.0.0+1 #
- Updated documentation.
1.0.0 #
- First stable release
- Minor fixes and improvements.
- Updated documentation.
0.9.7 #
- Minor fixes and improvements.
0.9.6 #
- Updated documentation.
0.9.5 #
- Minor fixes.
0.9.4 #
- Minor fixes.
0.9.3 #
- Minor fixes.
0.9.2 #
- Minor fixes.
0.9.1 #
- Minor fixes and improvements.
0.9.0 #
- Initial release.