graft 1.0.0-alpha.4
graft: ^1.0.0-alpha.4 copied to clipboard
Self-optimizing state management engine for Flutter: BLoC-style domain models, Signals-level micro-rebuild precision, and register-level CPU bitmask diffing.
Changelog #
All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.
1.0.0-alpha.4 #
๐พ Deterministic 32-bit FNV-1a Fingerprinting, Ultra-Clean Constructor Hydration & Two-Tier Contract Enforcement #
- Deterministic 32-bit FNV-1a Schema Fingerprinting:
- Replaced non-deterministic
Object.hash()andType.hashCodeacross separate Dart VM process launches / isolates with an invariant 32-bit FNV-1a integer hashing algorithm (.toSigned(32)). - Eliminates Frame-0 cold start / hot restart cache invalidation while preserving strict deterministic invalidation on real schema evolution (order swap, field mutation, or version change).
- Replaced non-deterministic
- Ultra-Clean Constructor Hydration (
super.dry(State.new)&factory => Model.new):- State and domain sub-models declare constructor defaults once; Graft auto-hydrates into constructor arguments on Frame 0 with zero
hydrate(tuple)casting and zero manual index cursors. - Domain sub-models extending
GraftModeldeclare a 1-line constructor tear-off:@override Function get factory => Model.new;.
- State and domain sub-models declare constructor defaults once; Graft auto-hydrates into constructor arguments on Frame 0 with zero
- Mandatory
schemaVersionfor Deterministic Safety:- Added
@override int get schemaVersion => 1;contract onGraftStateandGraftModel. Guarantees deterministic invalidation even when all properties share the identical Dart type (e.g., 10Stringfields) and order is swapped.
- Added
- Two-Tier Enforcement (Static Lint + Runtime Fail-Fast):
- Static (
graft_lint): AddedRequireDryContractsRuleto flag missingschemaVersionon persistent states and missingfactoryorschemaVersionon nested models at compile-time. - Runtime: Fail-fast
StateErrorinDryStateHook/Graft.drywith descriptive messages ifschemaVersionorfactoryis missing.
- Static (
- Automatic App Lifecycle Flush (
GraftLifecycleObserver):- Flushes debounced storage writes immediately upon
AppLifecycleState.paused,inactive,detached, orhidden, preventing lost writes on immediate app backgrounding or OS process termination. - Exported
GraftLifecycleObserverinlib/graft.dartand auto-registered inGraftRouteTrackerandconfigurePersistence.
- Flushes debounced storage writes immediately upon
- Crash-Proof Deserializer & Atomic Disk Writes:
- Corrupt or truncated binary files safely return
nullinstead of throwingRangeError, automatically purging invalid cache entries. - Reversible URI key encoding in
FileStateConfig(Uri.encodeComponent/Uri.decodeComponent). - Atomic disk writes using
.bin.tmpfile renaming to avoid corrupted files on process kill.
- Corrupt or truncated binary files safely return
- Strict Developer API Encapsulation & Surface Lockdown:
- Encapsulated internal state engine plumbing (
bindGraft,initBaseline,baselineSnapshot,diffChanges,version,isDryEnabled,customDryKey) into@internal abstract final class GraftStateEngine(hidden fromlib/graft.dart). - Encapsulated slot engine receivers (
_fastDirectReceiver,_indexedItemReceivers,_registerItemReceiver,_notifyItem,_notifyMask) into@internal abstract final class GraftEngine(hidden fromlib/graft.dart). - Marked
operator ==andhashCodewith@override @nonVirtualonGraftState,GraftModel, andGraft, ensuring reference equality is strictly preserved and preventing developers from overriding them with equatable-style value equality. - Locked all operational methods on
GraftState,GraftModel, andGraftwith@nonVirtual, exposing only intended overridables (props,schemaVersion,dryKey,factory,onReset,onInit,onDispose,dispose). - Added recursive nested
GraftModelconstructor hydration and typed collection casting (List<String>,List<int>,List<double>,List<bool>) inDryStateHook.
- Encapsulated internal state engine plumbing (
- Official Starter Template Released (
graft_template):- Published graft_template โ the official production-grade starter template combining Graft state management, DI, and Frame-0 dry persistence with CoreKit (
core_kit), complete with route-scoped controllers, zero-controller forms, Dio HTTP client, responsive scaling, and authentication.
- Published graft_template โ the official production-grade starter template combining Graft state management, DI, and Frame-0 dry persistence with CoreKit (
1.0.0-alpha.3 #
๐ Intelligent DI Observability, Frame-0 Dry Telemetry & Non-Blocking Async Logging #
-
Intelligent DI Scope & Active Member Teardown Tracking:
- Added
onScopeCreated(scopeId, {bool preserved})andonScopeDropped(scopeId, {List<Type> members, List<Type> registeredTypes})hooks toGraftObserver. GraftDevObserverpretty-prints DI scope mounts ([๐ฆ GRAFT DI SCOPE CREATED] | ScopeId (mode)) and introspects concrete active instances during reverse DAG teardowns ([๐ฅ GRAFT DI SCOPE DESTROYED] | ScopeIdlisting all active disposed members).- Added
onDependencyBound(type, ...)hook to track individual dependency registrations into scopes.
- Added
-
Frame-0 Dry Persistence Observability & Badges:
- Added
onDryHydrated(state, {required String key, required bool fromCache})distinguishing synchronous L1 RAM restorations (< 50ns) from fresh defaults ([โ๏ธ GRAFT DRY HYDRATED]). - Added
onDryInvalidated(target, {required String key, bool isScopePurge})logging individual state cleanups (graft.invalidateDry()) and flow-wide scope purges (scope.invalidateDry()) ([๐งน GRAFT DRY INVALIDATED],[๐งน GRAFT DRY SCOPE PURGED]). - Persistent states automatically receive high-visibility
๐พ [DRY: key]badges across creation, transitions, and disposal.
- Added
-
Non-Blocking Asynchronous Microtask Logging Queue:
- Decoupled console I/O and OS log daemon writes from the synchronous state mutation and widget build pipelines via
asyncLog: true(default). - Log events are queued in-memory in $< 5\text{ ns}$ ($O(1)$ list push) and flushed in microtasks, guaranteeing zero frame drops or jank during 60/120fps animations.
- Decoupled console I/O and OS log daemon writes from the synchronous state mutation and widget build pipelines via
-
Developer Experience & Suppressed State Change Spam:
logStateandlogChangesdefault tofalseinGraftDevObserver, keeping the developer console clean and focused on architecture events (DI scopes, dry hydrations, errors) without flooding the terminal on every keystroke or frame.- Added granular constructor flags (
logDI,logDry,logState,logChanges,logBindings,logRebuilds,logErrors,asyncLog,enableTimeline) with rich inline doc comments for instant IDE hover inspection.
-
Route Transition & Tombstone Lifecycle Safety:
- Added route tombstoning in
GraftRouteTrackerduring route replacement and exit animations, preventing zombie or duplicate controller instantiations during unmount animation passes.
- Added route tombstoning in
1.0.0-alpha.2 #
๐ Documentation Polish, Storage Abstraction & pub.dev Score Optimization #
- Valid pub.dev Package References: Replaced local file URLs across all technical markdown guides with relative links, fixing pana markdown validation and scoring 100% on pub.dev.
- Custom Storage Abstraction &
SharedPreferences: Added production-readySharedPrefsStateConfiginGRAFT_GUIDE.mdandREADME.mddemonstrating synchronous L1 pre-warming (readAllSync()) with zero blank frames on Frame 0. - Lifecycle Architectural Clarifications:
- Clarified that domain
GraftStateand storage contractGraftStateConfighave zeroinit()methods; dependencies are passed via standard constructors. - Documented native controller lifecycle hooks (
onInit()&onDispose()) onGraftcontrollers.
- Clarified that domain
- Route-Stack Borrowing & Scoping: Expanded
context.use<T>()andGraftScope(factories: [...])documentation with idiomatic examples for navigation route stacks and tab shell layouts. - Linter Rules & Best Practices: Documented
graft_linterror rules (avoid_nested_graft_slot,prefer_props_in_graft_state,require_graft_route_observer).
1.0.0-alpha.1 #
๐ Frame-0 Dry Persistence Hardening & Enterprise Dependency Injection (DI) Engine #
-
Frame-0 Dry Persistence (
onDry&dry):- Zero Magic Strings & Zero Boilerplate: Introduced dedicated
@override void onDry()lifecycle method onGraftStateandGraftModelusingname = dry(name)with automatic generic type inference and fallback defaults. - Selective Persistence: Domain state properties listed in
propsOfare surgically tracked for UI diffing, while only properties listed inonDry()are persisted to disk. Transient fields (e.g.isLoading,errorMessage,activeTab) automatically start fresh on app launch. - Decoupled Ordering: UI diffing order in
propsOfis completely decoupled from persistence order inonDry(). Scrambled or reordered fields map deterministically without index shift bugs. - Cascaded
GraftModelPersistence: AddeddryModel(address)for deep domain models with recursive snapshotting, diffing, and in-place hydration. - Sub-Microsecond Hydration Latency: Verified at ~1,547 ns (~1.5 ยตs, 646,000 ops/sec) in
test/benchmark/frame0_hydration_benchmark_test.dartโ over 46ร faster than JSON HydratedBloc. - 15 Worst-Case Persistence Scenarios: Fully verified in
test/persistence/worst_case_dry_test.dartcovering scrambled orders, identical types, nullable values, schema evolution, corrupted bytes, and rapid mutation bursts.
- Zero Magic Strings & Zero Boilerplate: Introduced dedicated
-
Enterprise Dependency Injection (DI) Engine (
GraftDI):- Sub-Nanosecond Lookups: Monotonic 32-bit integer indexing (
TypeId.of<T>()) eliminates string hashing and runtime reflection ($\le 12\text{ ns}$ cold lookup, $< 0.8\text{ ns}$ hot V-table access). - In-Degree Topological Reverse DAG Teardown: Dependent consumers are guaranteed to be disposed before underlying database connections, preventing
SqliteException: Cannot operate on closed databasecrashes. - Self-Healing Non-Blocking Async Gates:
bindAsync<T>()anduseAsync<T>()allow lazy database, network, and storage services to initialize in the background without blocking Frame 0. Concurrent callers await the same in-flight future without duplicate connections. - Developer Enum Scopes: Group dependencies under type-safe enums (
scope(AppScope.checkout, ...)) with flow-wideAppScope.checkout.drop(). - Real SQLite Database Verification: Verified against real SQLite in
test/di/real_sqlite_di_test.dartcovering multi-tier DAOs, transactions, rollback integrity, disk.dbpersistence across restarts, and zone-isolated mock testing. - Unified Bridge with
GraftRegistry:context.use<T>()automatically discovers controllers registered viabind()orGraftRegistry.
- Sub-Nanosecond Lookups: Monotonic 32-bit integer indexing (
-
Comprehensive Test Suite & Quality Assurance:
- Test suite expanded to 283 passing tests across 71 test files with 100% pass rate.
- Static analysis verified with 0 issues / 0 warnings (
dart analyze lib/ test/). - Strict code organization: all persistence and DI engine files remain strictly under 200 lines.
0.1.2-alpha.5 #
๐ Public Alpha Release & Core Engine Hardening #
- Core Architecture & Type-Safe
propsContract:- Compiler-enforced
GraftProps get props => propsOf(...)contract for domain properties. - Direct synchronous cascade updates via
state..field = val..update()and functional mutations viamutate((s) => ...). - In-place baseline diffing and
reset()with zero GC heap allocations.
- Compiler-enforced
- Hardware-Aligned 64-Bit Bitmask Diff Engine:
GraftMaskevaluates up to 64 state properties directly in CPU registers via 1-cycle bitwise operations.- Effortlessly scales into unbounded chunked 32-bit words for 128, 500, or 1,000+ fields with 100% web JS compatibility.
- Universal Multi-Platform Support:
- Native IO: iOS, Android, macOS, Windows, Linux, and Embedded targets.
- Modern Web: Verified with both JavaScript (
dart compile js) and WebAssembly (dart compile wasm). - Conditional platform exports for bitmask vector math (
graft_simd_io.darton Native vsgraft_simd_web.darton Web/WASM).
- Reactive UI Slots & Virtualization:
graft.slot/ callablegraft((s) => ...): Single-child leaf slots with Depth-$N$ parent rebuild insulation.graft.slots: Universal multi-child layout diffing engine (Column,Row,Wrap,Stack,Flex) with self-optimizingignoredMaskpre-flight bypass.graft.builder: 100% lazy virtualized collections (ListView.builder,GridView.builder) with per-item slot isolation.graft.compute: Pre-flight derived computation cache with zero layout rebuild overhead.graft.async: Declarative, pattern-matched slots (idle,loading,data,error) for asynchronous domain states.GraftBoundary: Element-level rebuild firewall with ambient auto-discovery and backward adaptive learning.NoSubscriptionContextprevents ambientThemeorMediaQuerysubscriptions from leaking into parent layouts.
- Route-Stack Dependency Injection & Lifecycle:
- Zero-setup
context.use<T>()inherits existing controllers across predecessor routes withoutMultiProvidernesting. - Automatic owner-controlled disposal when the route that created the controller pops from the
Navigator. - Transient popup protection (
resolveOwnerRoute):showDialogandshowModalBottomSheetborrow safely without disposing host controllers. GraftRouteTracker.observerstatic accessor for registration inMaterialAppandCupertinoApp.
- Zero-setup
- Concurrency & Telemetry:
- Monotonic token counter (
_currentAsyncTaskId) inrunAsyncautomatically drops out-of-order stale network/IO responses. GraftDevObserverwith colorized terminal logging andenableTimeline: truefor Flutter DevTools Performance tracing.- Declarative unit testing harness (
graftTest) inpackage:graft/testing.dart. - 211 passing tests across 54 test files with 100% pass rate.
- Monotonic token counter (
- Documentation & DX Overhaul:
- Complete documentation with Quick Start, architectural pillars, empirical benchmark scorecard, and full API reference.
0.1.2-alpha.4 #
โก Adaptive Pre-Flight Bypass & Zero-Allocation Nested Diffing #
- Adaptive Multi-Slot Pre-Flight Bypass (
ignoredMask):- Added
ignoredMasktracking toSlotMetadatato cache domain property indices that have been proven not to affect a slot's rendered output. - Implemented whole-layout pre-flight short-circuiting in
GraftMultiChildDiffEngineState._onStateDirty: skips callingchildrenBuilderand avoids all widget heap allocations when the activedirtyMaskis covered by all slots' learned ignore masks. - Added slot-level ignore checks inside the reconciliation loop, eliminating redundant
isWidgetEquivalentevaluations once a slot's ignore mask is cached. - Added automatic ignore mask invalidation on
reassemble()anddidUpdateWidget()for full Flutter hot reload safety. - Verified in
test/adaptive_slot_preflight_test.dart.
- Added
- Zero-Allocation Nested State Diffing:
- Optimized
GraftState.diffChangesfor nestedGraftStatemodels: compares sub-props directly against baseline snapshots, eliminating redundant snapshot list allocations on unchanged frames. - Inlined
_deepEqualswith@pragma('vm:prefer-inline')for sub-microsecond collection equality checks. - Verified in
test/nested_substate_mutation_test.dart.
- Optimized
- Streamlined Public API Surface:
- Removed redundant layout aliases (
graft.columnandgraft.row). - Unified multi-child slot diffing exclusively under
graft.slots(layout: ..., children: ...), keeping layout concerns orthogonal to state management while preserving 100% of the underlying slot-diffing engine and philosophy.
- Removed redundant layout aliases (
- Benchmark Performance Verification:
- Multi-child slot pipeline execution time improved by 16.3% (75.88 ms โ 63.47 ms) with 0 wasted builds in
test/benchmark/widget_rebuild_benchmark_test.dart. - Average diff pass latency reduced to 1,227.6 ns across 10,000 passes with 0 GC pauses.
- All 185 test cases passing with 100% green status.
- Multi-child slot pipeline execution time improved by 16.3% (75.88 ms โ 63.47 ms) with 0 wasted builds in
0.1.2-alpha.3 #
โก Declarative Async Pattern-Matching & Structural Fingerprint Expansion #
- Declarative Async Pattern-Matching (
graft.async&GraftAsync.when):- Added
.when<R>()pattern-matching method to sealedGraftAsync<T>hierarchy for type-safe, exhaustive handling ofidle,loading,data, anderrorstates. - Introduced
graft.async<T>()widget extension onGraft<S>, enabling fine-grained, isolated slot rendering bound to asynchronous state transitions with zero selector boilerplate. - Verified in
test/graft_async_widget_test.dart.
- Added
- Extended Layout Primitive Fingerprinting (
SlotMetadata.computeFingerprint):- Expanded sub-nanosecond integer hashing in
SlotMetadatato deeply fingerprint common layout primitives:SizedBox,Padding,ColoredBox,Align, andOpacity. - Enables instant 1-cycle bypass (< 5 ns) for structural layout containers during slot reconciliation passes.
- Expanded sub-nanosecond integer hashing in
- Self-Healing Adaptive Bitmask Test Harness:
- Added comprehensive test suite
test/self_healing_bitmask_test.dartcovering multi-slot layouts, rapid single-field and multi-field mutation bursts, and verified zero-rebuild isolation for unmutated slots.
- Added comprehensive test suite
- Architecture & Lifecycle Documentation:
- Updated runtime lifecycle flow and slot diffing diagrams in
README.mdto document the unifiedrunAsyncbinding and self-healing bitmask reconciliation pipeline.
- Updated runtime lifecycle flow and slot diffing diagrams in
0.1.2-alpha.2 #
โก Core Engine Hardening & Context Decoupling #
- Recursive Snapshot Contract & Nested State Diffing:
- Upgraded
GraftState's snapshot engine to recursively clone nestedGraftStatesub-states via theirprops, alongside deep snapshots ofList,Set, andMapcollections. - Deep-equality diffing in
diffChangesdetects in-place cascade mutations on nested models (state..address.city = 'Berlin'..update()) with 100% snapshot integrity, eliminating the need forcopyWithboilerplate. - Verified in
test/nested_inplace_mutation_test.dart.
- Upgraded
- Safe AST Reconciliation with
NoSubscriptionContext:- Introduced
NoSubscriptionContext, a specialized proxyBuildContextthat safely resolvesInheritedWidgets (such asTheme.of(context)orMediaQuery.of(context)) during fine-grained widget diffing without registering the underlying element inInheritedElement._dependents. - Guarantees zero context dependency leaks and prevents out-of-band rebuild cascades during background slot evaluation.
- Verified in
test/context_isolation_leak_test.dart.
- Introduced
- Transient Route Lifecycle Protection (
PopupRoute):- Enhanced
GraftRouteTrackerwithresolveOwnerRouteto distinguish host screen routes (PageRoute) from transient overlay routes (PopupRoute, such asshowDialogorshowModalBottomSheet). - When dialogs or bottom sheets borrow or instantiate controllers via
context.use<T>(), ownership is cleanly anchored to the hostingPageRoute. Dismissing the popup no longer triggers premature controller disposal. - Verified in
test/dialog_popup_lifecycle_test.dart.
- Enhanced
- Deterministic Multi-Field Bitmask Union:
- Upgraded
GraftBoundary's backward adaptive dependency learning to accumulate observed field bitmasks via bitwise union (_learnedDependencies[graft] |= fieldMask) across all builder passes, preventing multi-field dependency dropping. - Verified in
test/deterministic_slot_bitmask_test.dart.
- Upgraded
- Comprehensive Test Suite Expansion:
- Expanded test coverage from 116 to 164 test cases (100% pass rate) with 0 static analysis warnings across unit, widget, and hardware benchmark suites.
0.1.2-alpha.1 #
โก Hardware-Aligned Engine & Self-Optimizing Architecture #
- Multi-Field Bitmask Tracking (
fieldDependenciesMask): UpgradedSlotMetadatato accumulate multi-field dependencies into a cumulative 64-bit integer bitmask, completely resolving the single-bit locking bug and guaranteeing zero stale UI occurrences when slots depend on multiple domain fields. - Copy-on-Write State Transitions (
produce): Addedproduce((s) => s..field = x)method toGraft<S>, combining zero-boilerplate cascade syntax with distinct immutablecurrentStateandnextStatesnapshots for auditable logging and time-travel testing. - First-Class Async Engine (
GraftAsync<T>&runAsync): Added sealedGraftAsync<T>hierarchy (idle,loading,data,error) andrunAsync()automated task runner. - Subtree Scoping for Modern Routing (
GraftScope): AddedGraftScopewidget to supportGoRouter'sStatefulShellRoute, persistent bottom navigation tabs, and modal dialogs with automatic subtree lifecycle cleanup. - 64-Bit Integer Dirty Bitmask: Replaced synthetic context reflection hacks with hardware-level integer bitmasks evaluated in CPU registers.
- Zero-Allocation In-Place Snapshots: State diffing mutates baseline snapshots in-place with 0 GC heap allocations. Verified in
test/zero_allocation_benchmark_test.dart(~750โ1,300 ns per pass in debug VM, < 50 ns in AOT compiled mode). - Self-Optimizing Slot Table (
SlotMetadata): Each slot retains lightweight metadata that adaptively correlates to domain field indices during mutation bursts, escalating from structural inspection to 1-cycle CPU bitwise checks:(dirtyMask & fieldDependenciesMask) != 0. - Depth-$N$ Rebuild Insulation (
graft((s) => ...)&graft.slot): Unified single-slot leaf rendering with the ultra-clean callable syntaxgraft((s) => ...), providing complete Element-level rebuild insulation for intermediate parent containers (Card,Container,Padding). - Synchronous & Coalesced Updates: Direct cascade updates via
state..update()notify synchronously for zero-latency UI updates; addedstate..updateCoalesced()for microtask debouncing in rapid loops. - Disordered Slot Resolution: Full support for UI slot layouts that differ in order from state
trackeddefinitions, verified intest/disordering_test.dartandtest/multi_field_slot_test.dart. - Dynamic Branch Reconciliation: Slot table dynamically expands and contracts on conditional branches (
if, collection-for), properly disposing dropped slot notifiers to prevent memory leaks. - 100% Verified Test Suite: 116 test cases passing with zero warnings and zero analyzer issues across the entire workspace.
๐ Tooling & Linter Updates (graft_lint) #
- New Rule (
prefer_tracked_in_graft_state): Warns when a domain state class extendingGraftStatedeclares fields without overridingtracked, prompting developers to declareList<Object?> get tracked => [...]to unlock hardware-aligned 1-cycle bitmask execution. - Enhanced
avoid_nested_graft_slot: Flags illegal nesting of slots and layout scopes.
0.1.1-alpha.1 #
๐ Tooling & Linter Updates (graft_lint) #
- Promoted
avoid_nested_graft_slotto Error: Redundant slot nesting is now flagged as a compile-time analyzerError(ErrorSeverity.ERROR) by default to prevent anti-patterns early in IDEs and CI. - Fixed Ambiguous Import: Resolved
LintCodecollision betweenanalyzerandcustom_lint_builder. - Published
graft_linton pub.dev: Package is now publicly distributed via pub.dev/packages/graft_lint. - Documentation: Expanded setup guides, added Bad vs. Good code examples, and documented
analysis_options.yamlconfiguration patterns.
0.1.0-alpha.1 #
First public alpha release of Graft โ high-performance, fine-grained reactive state management for Flutter.
๐ Alpha Release Notice โ Let's Have a Ride! Graft is in its initial alpha release and is not yet declared production-ready. We invite developers to take it for a spin, test its slot diffing and route-scoping capabilities across diverse architectures, and help us discover edge cases, ideas, and feedback on GitHub Issues as we march toward 1.0!
โจ Key Features #
1. Core State & Reactivity
- Domain State Model (
Graft<S>): Structured, cohesive state containers powered byGraftState. - Batched Cascade Updates: Mutate state cleanly using Dart cascades (
state..name = 'Alice'..update()) with automatic single-pass change emission. - Single-Value State (
ValueGraft<T>): Zero-boilerplate reactive wrappers for primitives and enums without declaring a dedicated state class. - Disposal & Safety Guardrails: Hardened lifecycle guards preventing memory leaks and state updates to disposed controllers.
- Reentrancy Guard & Microtask Batching: Multiple synchronous
notify()calls during an active transition are batched into a single microtask emission.
2. Fine-Grained Rebuild & Slot Diffing Engine
- Slot Isolation (
graft.slot({required builder})): Eliminates the "Pyramid of Selectors" by updating only specific subtrees on state changes. - Multi-Child Slot Diffing (
graft.slots({required layout, required children})): Diff multi-child layouts (Column,Row,Wrap,Stack,Flex) without manual selector wrappers. - Collection Builder Support (
graft.builder<T>({required items, itemBuilder})): Virtualized collection diffing with zeroitemCountboilerplate; automatically defaults layout toListView.builderwith customizable layout overrides (GridView.builder,SliverList). - Pre-Flight Derivation (
graft.compute<R>({required compute, required builder})): Pure functional computation cache that skips widget builds entirely when derived values remain unchanged. - 100% Named Parameter Harmonization: Consistent developer ergonomics across all widget slot methods (
slot,slots,compute,builder,item,valueGraft.slot). - Deep Property Diffing: Native deep comparison for 25+ Flutter widgets (
Text,RichText,Icon,SizedBox,Padding,ColoredBox,Align,DecoratedBox,Opacity,ClipRRect,Flex,Flexible,FittedBox,Stack,Positioned,Wrap,GestureDetector,InkWell,IconButton,Image,ProgressIndicator,Checkbox,Switch,Slider, and more). - Transparent Wrapper Unwrapping: Automatically unwraps single-child wrappers (
Padding,Container,Card,Scrollbar,RefreshIndicator) in layout contracts. - Anti-Pattern Cycle Guard (
GraftScopeGuard): Developer-friendly error diagnostics preventing accidental nested slot creations.
3. Route-Stack Dependency Injection
- Zero Provider Nesting: Retrieve controllers via
context.use<T>()without wrapping screens inMultiProviderorBlocProvider. - Stack-Aware Scope Sharing: Sub-routes automatically borrow active controllers from predecessor routes in the navigation stack (
ModalRoute.of(this) ?? GraftRouteTracker.currentRoute). - Automatic Lifecycle Disposal: When a route pops,
GraftRouteTrackerautomatically disposes any controller owned by that route. - Registry & Fallback Support (
GraftRegistry): Global factory registration with eager or lazy instantiation, plus support for custom DI locators (e.g.get_it).
4. Observability & Telemetry
- Global Event Hooks (
GraftObserver): Audit logging for controller creation, state changes, slot rebuilds (onSlotRebuild), errors, and disposal. - Developer Console Logger (
GraftDevObserver): Colorized, structured console telemetry with optional slot-rebuild logging (logRebuilds: true). - Detailed State Diffs (
GraftChange<S>): Full tracking of prior and subsequent states with transition metadata.
5. Developer Ergonomics & Tooling
- IDE Snippets Generator (
bin/snippets.dart): Quick installer for VS Code / Cursor snippets (.vscode/graft.code-snippets) and Android Studio / IntelliJ live templates (graft-controller,graft-slot,graft-slots,graft-builder,graft-compute,graft-test). - Custom Linter Package (
packages/graft_lint): Dedicated compile-time analyzer plugin providing rules:avoid_nested_graft_slot: Warns against redundant nested slot invocations.require_graft_route_observer: Suggests registeringGraftRouteTracker.observerinMaterialApp.navigatorObservers.
6. Benchmarking & Pure Dart Declarative Testing
- Automated Rebuild Benchmark (
test/benchmark/column_rebuild_benchmark_test.dart): Formally asserts 90.0% rebuild reduction in 10-slot layout (60 rebuilds vs 600 rebuilds). - Declarative Test Harness (
graftTest): Sub-millisecond pure Dart unit testing with declarativesetUp,build,act,wait,expect,verify, andtearDownstages. - 100% Test Coverage: Comprehensive test suite covering 100.0% of lines across all library source files.