mz_utils 1.2.0
mz_utils: ^1.2.0 copied to clipboard
Flutter utilities for state management, logging, collections, and rate limiting with auto-disposal and extensions.
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.
1.2.0 - 2026-01-09 #
Added in 1.2.0 #
Memoization Utilities
Memoizerstatic class for tag-based caching of async results (consistent withDebouncerAPI)Memoizer.run(tag, computation)- cache async results by tagMemoizer.getValue(tag)/hasValue(tag)/isPending(tag)- check cache stateMemoizer.clear(tag)/clearAll()- invalidate cache- TTL (time-to-live) support for automatic cache expiration
- In-flight request deduplication using
Completer(concurrent calls share the same computation) forceRefreshparameter to bypass cache- Dynamic tags for key-based caching:
Memoizer.run('product-$id', ...)
Debouncer Async API
Debouncer.debounceAsync<S, T>()for typed async debouncing with return valuesDebouncer.fireAsync<S, T>()for immediate execution of async debounced functions- Merged functionality from AdvanceDebouncer into Debouncer
Controller Lookup Enhancements
listenparameter added toController.ofType()andController.maybeOfType()listen: true(default) - widget rebuilds when controller is replacedlisten: false- use in callbacks (onPressed,onTap) to avoid unnecessary rebuilds- Follows the same pattern as
Provider.of(context, listen: false)
Removed in 1.2.0 #
- AdvanceDebouncer class removed - use
Debouncer.debounceAsync()instead batch()method removed from Controller - batch updates feature removed
Changed in 1.2.0 #
Debouncer.cancel(),cancelAll(),count(),isActive()now handle both sync and async operations- Renamed
simple_logger.darttologger.dartfor better naming consistency - Renamed
controller_watcher.darttowatcher.dartfor brevity
1.1.0 - 2026-01-06 #
Added #
Controller Extensions
derive()method onControllerfor creating derivedValueControllerinstances- Automatically updates when source controller changes
distinctparameter to control notification behavior (default: true)autoDisposeparameter for automatic cleanup when listeners are removed (default: true)- Safe to use with
ValueListenableBuilder- auto-cleans up on widget unmount
ListenableNum Improvements
ListenableNumclass for observable numeric values with arithmetic operations- Arithmetic operators (
+,-,*,/,~/,%, unary-) now return the computed valueTfor easier chaining
Changed #
Controller Extension Renaming
- Renamed
ControllerWatchSimpleExtensiontoControllerMZXfor consistency - Improved documentation for
watch(),select(), andderive()methods with{@tool snippet}directives
Listenables
- Renamed
listenable_iterables.darttolistenables.dartfor better naming - Enhanced
ValueControllerdocumentation with Flutter SDK standard patterns
1.0.0 - 2026-01-06 #
Changed in 1.0.0 #
BREAKING CHANGE: Renamed EasyDebounce to Debouncer
EasyDebounceclass renamed toDebouncerfor better naming consistency withAdvanceDebouncerandThrottlerEasyDebouncerCallbacktypedef renamed toDebouncerCallback- All documentation and examples updated to use new naming
Migration Guide
Replace all occurrences of EasyDebounce with Debouncer in your code:
// Before (v0.0.1)
EasyDebounce.debounce('tag', duration, callback);
EasyDebounce.cancel('tag');
EasyDebounce.cancelAll();
// After (v1.0.0)
Debouncer.debounce('tag', duration, callback);
Debouncer.cancel('tag');
Debouncer.cancelAll();
0.0.1 - 2025-01-05 #
Added in 0.0.1 #
State Management
Controllermixin for type-safe state management with automatic lifecycle handlingControllerBuilderwidget for reactive UI updatesControllerProviderwidget for dependency injection.watch()extension onControllerfor simplified widget rebuilds- Key-based selective notifications for granular UI updates
- Priority listeners for ordered notification execution
- Predicate-based filtering for conditional notifications
Auto-Disposal
AutoDisposemixin for automatic resource cleanup- LIFO (last-in-first-out) cleanup order
- Support for Stream, Timer, and custom resource disposal
Observable Collections
ListenableList<T>- observable list with fullListAPIListenableSet<T>- observable set with fullSetAPI- Automatic listener notification on collection modifications
- Direct replacement for standard Dart collections
Structured Logging
SimpleLoggerwith six severity levels (trace, debug, info, warning, error, fatal)- Log groups for organizing related entries
- Multiple output formats: Console, File, JSON, Rotating files
- Customizable log formatting with color support
- Sampling and filtering capabilities
- Minimum level controls for production filtering
Rate Limiting
Debouncerfor simple debouncing (search-as-you-type)Throttlerfor limiting execution frequency (scroll events, button presses)AdvanceDebouncerfor type-safe async debouncing with cancellation- Configurable durations and immediate execution options
Extension Methods
IterableMZX:toMap(),toIndexedMap(),firstWhereWithIndexOrNull(), and moreListMZX:removeFirstWhere(),removeLastWhere(),swap()SetMZX:toggle(),replaceAll()StringMZX:toCapitalizedWords(),toCamelCase(),toSnakeCase(),isValidEmail()IntMZX:isEven,isOdd,isBetween()NumMZX:clampToInt(),roundToPlaces()WidgetMZX:padding(),center(),expanded(),visible()
Documentation
- Comprehensive README with quick start guide
- Getting Started guide with step-by-step integration
- Core Concepts documentation explaining architecture
- Troubleshooting guide for common issues
- Full API documentation with examples
- Contributing guidelines
Example App
- Interactive demos for all features
- State management examples with multiple controllers
- Logging system with multiple output formats
- Rate limiting demonstrations
- Observable collections examples
- Extension method showcases
Infrastructure #
- 100% test coverage with unit and widget tests
- Very Good Analysis lint rules compliance
- BSD-3-Clause License
- GitHub repository and issue tracker
- pub.dev integration