Ark DI 1.3: retained feature scopes and a separate testing package
Retain local dependency state between screen visits, control ownership and final close, and test graphs with ark_di_test. Current releases: core 1.3.1, Flutter 1.2.1 and Test 1.0.1.
Keep a feature scope without promoting it to a global singleton
A user returns to a catalog, search screen or editor. Its dependencies belong to that feature, but rebuilding them on every visit discards live state and repeats initialization. Ark DI 1.3 adds retained local scopes so the application can keep that graph without moving its registrations into the global container.
The parent container owns the cache. Each consumer receives a separate lease granting access to a retained dependency graph. After the last lease is released, the graph may remain idle with its owned instances and their current state. A later acquisition can reuse it until the graph has been finally closed.
Capacity and idle timeout are explicit application choices. When full, the cache can retire an idle scope; it does not evict active consumers to admit another key. Applications can invalidate selected scopes or close the entire cache. This retains live objects in memory: it is not disk persistence, automatic data refresh or cancellation of arbitrary business operations.
Flutter: feature state and screen lifetime are separate
ark_di_flutter adds DiCachedScope, loading and error states, and restricted resolver access. A feature can retain its data across visits while screen-specific controllers live in a separate child scope and close when that screen is removed.
The complete cached-cart example demonstrates both lifetimes. The retained-scopes guide explains ownership, reacquisition and final disposal.
Configuration, diagnostics and tests
Core adds typed DiModule and DiConfiguration, rollback after failed configuration, and detached container/cache diagnostics without business-key values. Restricted resolver views expose only an explicit set of registrations.
The new ark_di_test belongs in dev_dependencies. DiTestScope.run awaits cleanup of its test graph, preserves the original test error if cleanup also fails, and provides matchers for diagnostic metadata. Core does not depend on the test runner.
Published versions
ark_di 1.3.1, ark_di_flutter 1.2.1 and ark_di_test 1.0.1 are available on pub.dev. The runtime additions shipped in core 1.3.0 and Flutter 1.2.0; the latest patches expand the English/Russian guides and examples. Test 1.0.1 also corrects the primary README layout, with pub.dev now reporting 160/160.