davianspace_hosting_flutter 1.0.3
davianspace_hosting_flutter: ^1.0.3 copied to clipboard
Enterprise-grade Flutter integration for DavianSpace hosting, connecting DI, lifecycle management, configuration, and logging to the widget tree.
Changelog #
All notable changes to davianspace_hosting_flutter are documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.0.3 — 2025-01-01 #
Added #
Core Widgets
-
ServiceProviderScope—InheritedWidgetthat exposes aServiceProviderto the widget tree.of(context)— looks up the nearest scope, throws a descriptiveFlutterErrorwith fix guidance when missing.maybeOf(context)— returnsnullwhen no scope exists (useful for optional feature gates).- Identity-based
updateShouldNotify— the root provider is created once at startup, so the scope never triggers spurious rebuilds.
-
HostProvider— declarativeStatefulWidgetmanaging the full host lifecycle within the widget tree:hostFactoryasync factory creates and returns a configuredHost.- Automatic
Host.start()ininitState. loadingBuilder/errorBuildercallbacks for async startup states.- Automatic
Host.stop()andHost.dispose()on widget disposal andAppLifecycleState.detached. mountedguard on everysetStatecall — safe across async gaps.- Idempotent shutdown — calling stop/dispose multiple times is harmless.
Context Extensions
-
ServiceResolutionextension onBuildContext— six ergonomic resolution methods plus direct provider access:Method Delegates to getService<T>()ServiceProviderBase.getRequired<T>()tryGetService<T>()ServiceProviderBase.tryGet<T>()getAllServices<T>()ServiceProviderBase.getAll<T>()getKeyedService<T>(key)ServiceProviderBase.getRequiredKeyed<T>(key)tryGetKeyedService<T>(key)ServiceProviderBase.tryGetKeyed<T>(key)serviceProviderReturns the ServiceProviderdirectly
Entry-Point Extensions
FlutterHostRunnerextension onHost— two entry-point methods:runFlutterApp(builder)— synchronous startup; host is started beforerunAppis called.runFlutterAppAsync(builder, {loadingWidget, errorBuilder})— callsrunAppimmediately and starts the host in the background. AFutureBuilderrenders the loading widget, then the error builder, or finally the application widget tree.- Both methods wrap the app in
ServiceProviderScopeand install a_HostLifecycleObserverthat tears down the host on dispose /AppLifecycleState.detached.
Lifecycle Management
_HostLifecycleObserver(internal) —WidgetsBindingObserverthat requests graceful shutdown viaApplicationLifetime, stops the host, and disposes the DI container when the app is detached or the widget is removed from the tree.- Fire-and-forget async shutdown in
dispose()— required because Flutter'sState.dispose()is synchronous. - Double-shutdown protection via
ApplicationLifetimeguard.
Quality & Documentation
- Comprehensive widget test suite — 15 tests covering scope lookup, extension resolution, host lifecycle, async startup states, keyed service access, error propagation, and lifecycle-observer shutdown.
- Enterprise-grade README with three quick-start approaches, full API reference tables, error-handling matrix, and testing guidance.
- Architecture documentation (
doc/architecture.md) describing design goals, component diagram, and threading/lifecycle safety guarantees. - Contributing guidelines, security policy, and changelog.
Ecosystem Integration
-
Depends on published first-party packages:
Package Role davianspace_hostingHost builder / lifecycle davianspace_dependencyinjectionService registration & resolution davianspace_loggingStructured logging davianspace_configurationLayered configuration
[Unreleased] #
No unreleased changes.