feat(core): simplify SignalContainer & add type-safe computedFrom overloads - #480
Open
rodydavis wants to merge 7 commits into
Open
feat(core): simplify SignalContainer & add type-safe computedFrom overloads#480rodydavis wants to merge 7 commits into
rodydavis wants to merge 7 commits into
Conversation
This was
linked to
issues
May 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR simplifies the generic API signature of
SignalContaineracross the reactivity framework and introduces 10 strongly-typed global overloads and Record-tuple extensions for thecomputedFromAPI. These additions ensure type-safety, enhance the DX (developer experience), and modernize the API structure.Detailed Changes
1. Core Simplification & Cleanup (
packages/signals_core)TfromSignalContainer<Arg, S>(and its constructor helper functions), making the container class much cleaner and less prone to generic parameter noise.import '../async/state.dart';statement fromcontainer.dart.2. Type-Safe
computedFromOverloads & Record ExtensionsIntroduced strongly-typed overloads and record-tuple extension methods to solve type issues with multi-dependency asynchronous computed signals:
computedFrom1throughcomputedFrom10which accept individual, strongly-typedReadonlySignaldependencies and automatically pass type-safe values to their callbacks (e.g.,FutureOr<T> Function(A, B, C)).ComputedFromExt1throughComputedFromExt10which enable elegant, premium inline bindings directly on Dart Records:3. Package Version Bumps
Updated all
pubspec.yamlandCHANGELOG.mdfiles to trigger minor version increases for the affected packages:signals_core:7.0.0➔7.1.0signals:7.1.0➔7.2.0signals_flutter:7.1.0➔7.2.0signals_hooks:7.1.0➔7.2.0signals_lint:7.0.0➔7.1.04. Tests & Documentation
packages/signals_core/test/async/computed_from_test.dartto verify all 10 overload levels, record-tuple extensions, reactive recalculation behavior, and value type-safety.dart scripts/generate_docs.dart.Verification & Testing Results
1. Unit Tests
All 829 test cases in the test suite passed successfully:
dart testAll tests passed!2. Static Analysis
Ran a workspace analysis across the modified packages:
No issues found!