shard 1.0.0-dev.1
shard: ^1.0.0-dev.1 copied to clipboard
A powerful, lightweight state management solution for Flutter with built-in persistence, debounce, throttle, and seamless widget integration.
1.0.0-dev.1 #
- New: [ShardLocator] for singleton registration
registerSingleton<T>(T instance)- Register an existing instanceregisterLazySingleton<T>(T Function() factory)- Register a factory, instantiated on first [get]get<T>()- Resolve the registered singletonisRegistered<T>()- Check if a type is registeredreset()- Clear all registrations (e.g. in test setUp)
- New:
stateSerializer<T>()factory function for JSON-based serialization- Eliminates the need to create separate serializer classes
- Works with any object that has
toJson()andfromJson()methods - Supports lists, maps, and nested objects
- New: [StringSerializer] for simple string state persistence
0.3.0 #
- New: Built-in caching support for [FutureShard]
- New: [CacheService] interface for cache storage backends
- New: [MemoryCacheService] singleton for in-memory caching
- New: [CacheEntry] class for cache entries with expiration
- New: [CacheMixin] for repository-level caching with
resolvemethod
0.2.0 #
- BREAKING CHANGE:
PersistentShard<T>is nowPersistentShard<T, K>T- Full state typeK- Persistence data type (can be a subset of T)- Allows persisting only the data you need, excluding loading states, errors, etc.
- BREAKING CHANGE:
StatePersistenceMixin<T>is nowStatePersistenceMixin<T, K> - BREAKING CHANGE: Added
onLoadComplete(K? data)callback- Called when load operation completes (replaces automatic state update)
- Receives the loaded data as parameter
nullis passed when storage is empty (first launch)- Developers have full control over how loaded data is merged into state
- BREAKING CHANGE: New abstract method
toPersistence(T state)required- Extracts the data to persist from the current state
- BREAKING CHANGE:
StateSerializer<T>is nowStateSerializer<K>in persistence config - BREAKING CHANGE: Removed
clear()method fromStateStorageinterface- The
clear()method was removed because it cleared all storage data, which is not useful for developers - Developers can reset state by using
emit(initialState)- auto-save will automatically sync to storage
- The
- BREAKING CHANGE: Removed
clearStorage()method fromStatePersistenceMixin - BREAKING CHANGE: Removed
clear()method fromPersistentShard- Developers now have full control over state reset using
emit()method
- Developers now have full control over state reset using
- New:
SimplePersistentShard<T>class for simple cases- Use when state type and persistence type are the same
- No need to override
toPersistenceoronLoadComplete - Reduces boilerplate for simple use cases
0.1.0 #
- Added MultiShardProvider widget. Simplifies providing multiple shards to the widget tree
- Type-safety improvements
- Removed unsafe
dynamiccasts in widget layer - Improved generic type preservation throughout the widget tree
- Better compile-time type checking
- Removed unsafe
- Development improvements
- Added
flutter_lintsas dev dependency for better code quality
- Added
0.0.2 #
- Updated package metadata and documentation links
- Added homepage URL pointing to documentation site
- Added issue tracker link
- Added documentation URL
- Added package topics for better discoverability
- Removed flutter_lints dependency from dev_dependencies
0.0.1 #
- Initial release of Shard - A powerful, lightweight state management solution for Flutter
- Core state management with [Shard] class
- Built-in persistence support with [PersistentShard]
- Async state management with [FutureShard] and [StreamShard]
- Debounce and throttle mixins
- Widget integration with [ShardProvider], [ShardBuilder], and [ShardSelector]
- Observer pattern for global state monitoring