mvvm_service 2.2.0
mvvm_service: ^2.2.0 copied to clipboard
A Flutter-native MVVM service layer that creates, loads, watches, shares, and disposes services according to the widget lifecycle.
1.0.0 #
- Initial version.
1.0.1 #
- Modified
ServiceBuilder<T>to automatically load its service only if it hasn't been initialized yet.
1.0.2 #
- Fixed an issue where services could not be referenced due to incorrect generic type handling.
1.1.0 #
-
Added
ServiceWhen<T>extension on services to declaratively build widgets based on their current state. -
Updated
ServiceBuilder<T>to dispose its Service instance when the widget is disposed if it fully owns the service.
1.1.1 #
- Added
ServiceWidgetOf, a widget that allows referencing an existing service from the widget tree. This widget is useful when a service has already been initialized and managed by an ancestor widget, allowing descendant widgets to access and rebuild in response to service updates without creating a new instance.
1.1.2 #
- Fixed the issue where
ServiceWidget<T>andServiceWidgetOf<T>could not correctly reference an ancestor service due to ServiceProvider not having an explicit generic type, ensuring descendant widgets can now access the service with the proper type.
2.0.0 #
Breaking Changes #
- Replaced
ServiceProviderwith a single rootServiceScope. - Removed
ServiceWidgetandServiceWidgetOf. - Removed
ServiceContainerand all multi-service container APIs. - Removed
Service.of()andService.maybeOf(). - Services are now lazily created through
BuildContext.serviceOf(). - Added automatic service sharing, watching, loading, and lifecycle disposal.
- Added
ServiceMode.readandServiceMode.watch.
2.1.0 #
- Added an optional
keyparameter toBuildContext.serviceOf(), allowing multiple independently configured instances of the same service type. - Added and exported
ServiceIdto identify services by their type and optional key.
2.2.0 #
- Added
BuildContext.stateOf()for creating reactive state backed byValueNotifier. - Added
StateScopeand theServiceScope.withStateconvenience constructor. - Added
StateMode.readandStateMode.watchto control widget rebuilds. - Added automatic state identity based on type and invocation order, with optional keys for explicit sharing or separation.
- Added an
onDisposecallback for cleaning up resources held by state values. - Added automatic disposal when a state no longer has dependent elements.