reactiv 1.0.2
reactiv: ^1.0.2 copied to clipboard
Production-ready reactive state management with robust logging, undo/redo, computed values, debounce/throttle, and more. Lightweight, powerful, and easy to use.
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.0.2 - 2025-11-01 #
✨ Added #
BindController Enhancement - Lazy Binding Option
- lazyBind parameter: New optional parameter in
BindControllerfor controlling controller instantiation timinglazyBind: true(default) - Controller is created lazily when first accessedlazyBind: false- Controller is created immediately when BindController widget is initialized
Use Cases:
- Set
lazyBind: falsefor controllers that need immediate initialization (e.g., listening to streams, starting background tasks) - Keep
lazyBind: true(default) for memory efficiency and performance optimization
Example:
// Lazy binding (default) - created when first accessed
BindController(
controller: () => MyController(),
lazyBind: true, // Optional, defaults to true
child: MyWidget(),
)
// Immediate binding - created at widget initialization
BindController(
controller: () => StreamController(),
lazyBind: false, // Created immediately
autoDispose: true,
child: MyWidget(),
)
Benefits:
- Better control over controller lifecycle
- Improved performance for controllers that must initialize early
- Flexibility to choose between lazy and eager initialization
- Memory optimization with default lazy behavior
🔄 Changed #
BindControllernow supportslazyBindparameter (defaults totruefor backward compatibility)
⚠️ Deprecated #
None
🚫 Breaking Changes #
None! The lazyBind parameter defaults to true, maintaining 100% backward compatibility with v1.0.1.
1.0.1 - 2025-11-01 #
✨ Added - Logger Framework Enhancement #
Complete rewrite of the Logger class - Transformed from basic logging utility into a robust, production-ready logging framework.
New Log Levels
- Verbose (
Logger.v()/Logger.verbose()) - Detailed trace-level information - Debug (
Logger.d()/Logger.debug()) - Diagnostic information - Info (
Logger.i()/Logger.info()) - General information (enhanced) - Warning (
Logger.w()/Logger.warning()) - Potential issues - Error (
Logger.e()/Logger.error()) - Error conditions (enhanced) - WTF (
Logger.wtf()) - What a Terrible Failure (critical errors)
Advanced Features
- Pretty JSON Logging:
Logger.json(object)with automatic indentation and formatting - Stack Trace Support: Full stack traces for errors using
errorandstackTraceparameters - Performance Timing:
Logger.timed()- Time async functions and log execution durationLogger.timedSync()- Time synchronous functions
- Table Formatting:
Logger.table(data)- Display structured data as formatted tables - Headers & Dividers: Visual organization with
Logger.header()andLogger.divider() - ANSI Color Support: Color-coded terminal output for better readability
- Gray for verbose, Cyan for debug, Green for info
- Yellow for warnings, Red for errors, Magenta for WTF
Configuration System
- LoggerConfig class for flexible, granular control
- Predefined configurations:
LoggerConfig.development- Full verbose logging with all featuresLoggerConfig.production- Minimal logging (disabled by default)LoggerConfig.testing- Warnings and errors only
- Configurable options:
enabled- Global on/off toggleminLevel- Minimum log level to display (filter logs by severity)showTimestamp- Include timestamps in log outputshowLevel- Display log level indicators ([V], [D], [I], [W], [E])showLocation- Show file and line numbersshowStackTrace- Automatically include stack traces for errorsprettyJson- Pretty-print JSON objects with indentationmaxLength- Truncate long messages to specified lengthcustomHandler- Custom log output handler for analytics/crash reporting
Custom Handlers
- Support for custom log handlers to integrate with third-party services
- Easy integration with Firebase Crashlytics, Sentry, custom analytics, etc.
- Maintain console logging while sending to multiple destinations
Additional Utilities
- Custom Tags: Categorize logs with custom tags for filtering
- Batch Operations: Efficiently log multiple related messages
📚 Documentation #
- docs/LOGGER.md - Comprehensive logger framework documentation
- LOGGER_IMPROVEMENTS.md - Feature overview, comparison tables, and migration guide
- LOGGER_QUICK_REF.md - Quick reference card for common patterns
- example/lib/logger_example.dart - Interactive demo application showcasing all features
🔄 Changed #
- Logger class completely rewritten (~570 lines)
- Enhanced existing
Logger.info()with additional parameters (error,stackTrace,tag) - Backward compatible
enabledproperty (now uses LoggerConfig internally)
⚠️ Deprecated #
None - All changes are 100% backward compatible!
🚫 Breaking Changes #
None! Version 1.0.1 maintains full backward compatibility with 1.0.0.
Old code still works:
Logger.enabled = false;
Logger.info('message');
New features available:
// Configuration
Logger.config = LoggerConfig.production;
// Multiple log levels
Logger.d('Debug message');
Logger.w('Warning message');
Logger.e('Error occurred', error: e, stackTrace: stack);
// Advanced features
Logger.json({'user': 'John', 'preferences': {'theme': 'dark'}});
await Logger.timed(() => fetchData(), label: 'API Call');
Logger.table([{'name': 'John', 'age': 30}]);
Logger.header('SECTION TITLE');
📊 Statistics #
- Files Changed: 7
- Lines Added: +1,162
- New Methods: 15+
- New Features: 10
- Breaking Changes: 0
- Documentation Pages: 3 comprehensive guides
1.0.0 - 2025-11-01 #
🎉 Major Release - Production-ready with comprehensive improvements and new features!
🔴 Fixed (Critical) #
- Fixed memory leak in
addListener: Listeners are now properly invoked when reactive values change - Fixed memory leak in
bindStream: Stream subscriptions are now properly managed and cancelled - Fixed
Observerwidget performance: Now uses optimizedvalueparameter instead of redundant lookups - Removed unnecessary
asynckeywords: MethodsaddListener()andremoveListener()are now synchronous
⚡ Performance #
- Batched updates for
ReactiveList: Multiple mutations in the same frame trigger only one rebuild - Batched updates for
ReactiveSet: Same batching strategy to prevent excessive rebuilds - Optimized Observer rebuilds: Eliminated unnecessary value access in widget builders
✨ New Features #
State Management
- Undo/Redo support: Enable history tracking with
enableHistory: trueparameter- Methods:
undo(),redo(),canUndo,canRedo,clearHistory() - Configurable history size with
maxHistorySizeparameter (default: 50)
- Methods:
- Computed reactive values: New
ComputedReactive<T>class for auto-updating derived state - Debounce support: Delay updates with
setDebounce()andupdateDebounced()methods - Throttle support: Limit update frequency with
setThrottle()andupdateThrottled()methods - Ever & Once utilities: Convenient listener methods
ever(callback)- called on every value changeonce(callback)- called once then auto-removed
Dependency Management
- Lazy dependency injection:
Dependency.lazyPut<T>()for deferred instantiation - Put with overwrite:
put()now overwrites existing dependencies with warning - Conditional registration: New
putIfAbsent()method - Dependency checking: New
isRegistered<T>()method - Global reset: New
reset()method to clear all dependencies - Fenix mode: Auto-recreation after deletion with
fenix: trueparameter
🛠️ Improvements #
Code Quality
- Custom exceptions: New exception classes with helpful error messages
DependencyNotFoundExceptionDependencyAlreadyExistsException
- Explicit return types: All methods now have proper return type declarations
- Fixed typo: Corrected "associa ted" to "associated" in documentation
Developer Experience
- Configurable logging: Control logging with
Logger.enabledflag - Warning and error logs: New
Logger.warn()andLogger.error()methods - Better error messages: All exceptions provide clear, actionable information
- Stream subscription management:
bindStream()now returnsStreamSubscriptionfor external control
📚 Documentation #
- NEW_FEATURES.md: Comprehensive guide to all new features with examples
- QUICK_REFERENCE.md: Quick-start guide for common use cases
- IMPLEMENTATION_SUMMARY.md: Technical implementation details
- Advanced example: New
advanced_features_example.dartdemonstrating all features
🔄 Changed #
- All reactive types (
ReactiveInt,ReactiveString, etc.) now support optional parameters:enableHistory- Enable undo/redo functionalitymaxHistorySize- Configure history buffer size
ReactiveNclass updated to support new optional parametersDependency.put()behavior changed to overwrite with warning (previously silently ignored)bindStream()now returnsStreamSubscriptioninstead ofvoid
⚠️ Deprecated #
None - All changes are backward compatible!
🚫 Breaking Changes #
None! Version 1.0.0 maintains full backward compatibility with 0.3.x versions.
📦 Migration Guide #
No migration needed! All new features are opt-in. To use them:
-
Enable logging control:
Logger.enabled = false; // Disable in production -
Use history tracking:
final text = ReactiveString('Hello', enableHistory: true); -
Create computed values:
final fullName = ComputedReactive( () => '${firstName.value} ${lastName.value}', [firstName, lastName], ); -
Use lazy dependencies:
Dependency.lazyPut(() => MyController());
📊 Statistics #
- Files changed: 20
- Lines added: 1,457
- Lines removed: 118
- New features: 8
- Bug fixes: 4
- Performance improvements: 3
- Code quality improvements: 7
0.3.6 Previous Release #
New widget ObserverN that accepts List of Reactive variables
0.3.5 #
Implement un-implemented methods in ReactiveSet
0.3.4 #
- New method added
initStateWithContext(BuildContext context)
0.3.3 #
- Now bind controller needs to be through Function(). e.g,
BindController(controller: () => MyCounterController())
0.3.2 #
- Now bind controller needs to be through Function(). e.g,
BindController(controller: () => MyCounterController())
0.3.1 #
- Added listeners getter
- Added option for remove all listeners
0.3.0 #
- Introduced BindController Class to bind the controllers with the screen smart and seamlessly
0.2.6 #
- Added support for
.reactivfor bool and num types - Update readme.md
0.2.5 #
Update readme.md
0.2.4 #
- ReactiveBool, ReactiveNum, ReactiveMap, ReactiveSet
0.2.3 #
- addListener method for Reactive variables
- Update ReadMe
0.2.2 #
- New method in Reactive types, bindStream to deal with streams
- ReactiveStateWidget and ReactiveState
0.2.1 #
- Update readme
0.2.0 #
- Breaking Change: params change
- listen => listenable
- update => listener
0.1.3 #
- Stream change to broadcast stream
- Params change
- listen => listenable
- update => listener
- ReactiveWidget major update:
- Auto dispose the controller functionality
- bindDependency method to Dependency.put() the dependency
- Life-cycle methods void initState(), void dispose(), methods added in ReactiveWidget
0.1.2 #
.reactivextension added- ReactiveList all the methods added for add new element and remove element from the list
0.1.1 #
Update documentation
0.1.0 #
Update documentation
0.0.3 #
Update example and readme
0.0.2 #
Name change:
- Reaction => Observer
- cause => listen
- effect => update
- Import file optimisations
0.0.1 #
Initial release. A new Reactive state management approach and dependency injection inspired by GetX