mastro 2.0.0+2
mastro: ^2.0.0+2 copied to clipboard
A robust state management solution for Flutter that seamlessly integrates reactive programming with event handling and persistence capabilities.
2.0.0+2 #
- Updated documentation.
2.0.0+1 #
- Updated
pubspec.yaml.
2.0.0 #
Added #
-
New Components:
MastroZone: A unified replacement forMastroBuilderandTagBuilder. It supports both automatic state-driven updates and lightweight tag-based refreshes, with an optionalshouldRebuildcallback for fine-grained rebuild control.TriggerableZone: New widget for imperative rebuilds using aTriggerableZoneController.LifecycleZone: Simple widget for lifecycle hooks (onViewCreated,onViewDestroyed) without requiring a box.MastroMemoryLeaksChecker: Debug tool for detecting undisposed resources (e.g., listeners, timers) in debug mode.LogOptionsandshowMastroLogs(): Enhanced logging with global and instance-level configuration for state changes and diagnostics.Autowire: Zone-based resource management for automatic cleanup of resources within box scopes.DependenciesScope: Internal mechanism for implicit dependency tracking inMastro.computed(...).
-
New Features:
Mastro.computed(...): New method for derived values with implicit dependency tracking, replacingdependsOnandcompute.- FAQ entry for logging: Added guidance on enabling logs using
showMastroLogs()andLogOptions.
Changed #
-
Renamed Components:
MastroViewrenamed toMastroWidgetto align with Flutter conventions.BoxProviderrenamed toBoxScope.MultiBoxProviderrenamed toMultiBoxScope.MastroScoperenamed toMastroHooks.OnPopScoperenamed toOnPopHook.
-
Updated Behavior:
MastroZonenow handles both state and tag reactivity, replacingMastroBuilderandTagBuilder.onViewAttachedandonViewDetachednow takeViewMetaDatainstead ofMastroViewfor lifecycle hooks.
Removed #
Mastro.dependsOn(...): Replaced byMastro.computed(...)with implicit dependency capture.compute(): Fully removed in favor ofMastro.computed(...).RebuildBoundary: Replaced byTriggerableZonefor imperative rebuilds.autoCleanupWhenAllViewsDetachedandautoCleanupWhenUnmountedFromWidgetTree: Removed as cleanup is now handled internally viaAutowire.
Fixed #
- Improved clarity in documentation for
MastroZoneusage, ensuring explicit state dependencies and tag-based refreshes are well-explained. - Enhanced persistence documentation for
PersistroLightroandPersistroMastrowith clearer factory and codec examples.
Notes #
- Logging configuration is now more robust, with the addition of
showMastroLogs()andLogOptionsfor better debugging control. - Ensure
MastroMemoryLeaksChecker.start()is called beforerunApp()in debug builds to leverage memory leak detection.
1.6.0 #
- Minor bug fixes and improvements.
- Updated documentation.
🚨 Breaking / Behaviour Changes #
- Removed
MastroView.rebuild()
The manual rebuild method has been deleted. Views should rebuild reactively viaMastroBuilder,TagBuilder, and state updates. - Removed standalone
compute()on state
All computed/derived wiring now goes throughdependsOn([...], compute: ...). See the Migration Guide below. - SEQUENTIAL events – waiting behaviour updated
The semantics for waiting onEventRunningMode.sequentialwere refined. Eachexecute(...)now completes when its own enqueued item finishes, while the queue continues to drain in order. Code that implicitly relied on the first caller waiting for the entire queue to finish should be updated toawaitthe specific calls it cares about
✨ Added #
.safeon state containers (Basetro<T>.safe)
A nullable accessor that returnsnullbefore a.late()state is initialized. Ideal for first-paint reads without throwing.clearDependencies()onMastro<T>
Removes all wired dependencies established viadependsOn(...)(idempotent). Use when changing the set of sources dynamically.
🔁 Changed #
- Derived values via
dependsOn
dependsOn([...], compute: ...)now covers whatcompute()used to do and more:- Depend on multiple states simultaneously (value intersections).
- Provide a
computefunction to set a derived value. - Notify‑only mode: omit
computeto propagate changes without mutating the dependent’s.value.
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.