Skip to content

refactor: move signal Listenable support into solidart via package:listen - #178

Draft
nank1ro wants to merge 5 commits into
mainfrom
refactor/listen-migration
Draft

nank1ro wants to merge 5 commits into
mainfrom
refactor/listen-migration

Conversation

@nank1ro

@nank1ro nank1ro commented Aug 27, 2026

Copy link
Copy Markdown
Owner

Summary

solidart signal classes now implement package:listen's ValueListenable/ValueNotifier natively (pure Dart). Because listen provides the Listenable machinery without Flutter, flutter_solidart no longer needs its own Flutter-specific signal wrappers — it becomes a thin layer that re-exports solidart plus the widgets.

Changes

solidart

  • ReadableSignal implements ValueListenable; Signal implements ValueNotifier (adds hasListeners/notifyListeners); Computed implements ValueListenable. ListSignal/MapSignal/SetSignal/Resource inherit through Signal.
  • addListener/removeListener are backed by the existing observe(), so auto-dispose semantics are preserved: a listener keeps an autoDispose signal alive, and removing the last listener disposes it.
  • notifyListeners() snapshots its listeners so a listener removing itself mid-notification can't throw.
  • Interface-conformance tests added to solidart's pure-Dart suite.

flutter_solidart

  • Barrel is now export 'package:solidart/solidart.dart' + SignalBuilder / Show / the toValueNotifier/toSignal bridge.
  • Deleted the 8 wrapper + mixin files under lib/src/core/.

⚠️ Parked — depends on flutter/flutter#189111

Latest Flutter (stable + master) does not yet re-export package:listen, so a Signal implements listen's ValueNotifier, which is a distinct type from Flutter's. Until flutter/flutter#189111 ("Migrate to listen package") merges and reaches master, a Signal is not directly assignable to a Flutter ValueListenableBuilder/AnimatedBuilder. Use SignalBuilder (idiomatic) or signal.toValueNotifier() in the meantime. Once that Flutter PR lands, the two ValueNotifier types unify and direct interop works for free.

Do not merge until flutter/flutter#189111 is in a released Flutter.

Verification

  • dart test packages/solidart — 185/185 pass
  • flutter test packages/flutter_solidart — 33/33 pass
  • flutter analyze (solidart, flutter_solidart, example, solidart_hooks) — no issues

Not included (follow-up for the actual dev release)

  • Version bumps + CHANGELOG entries (the breaking-change note above is release-worthy).

…sten

solidart signals now implement package:listen's ValueListenable/ValueNotifier
natively (pure Dart), so flutter_solidart no longer needs Flutter-specific
signal wrappers.

- solidart: ReadableSignal implements ValueListenable; Signal implements
  ValueNotifier (adds hasListeners/notifyListeners); Computed implements
  ValueListenable. ListSignal/MapSignal/SetSignal/Resource inherit via Signal.
  addListener/removeListener are backed by observe(), preserving auto-dispose
  semantics (a listener keeps an autoDispose signal alive; removing the last
  one disposes it). notifyListeners snapshots its listeners to stay reentrancy-safe.
- flutter_solidart: now just re-exports solidart plus the widgets (SignalBuilder,
  Show) and the toValueNotifier/toSignal bridge. Deleted the 8 wrapper/mixin
  files under src/core.
- Moved the interface-conformance tests into solidart's pure-Dart suite
  (asserting listen's types).

BREAKING: signals implement listen's Listenable types, not Flutter's, so a
Signal is not directly assignable to a Flutter ValueListenableBuilder/
AnimatedBuilder until flutter/flutter#189111 lands. Use SignalBuilder, or the
toValueNotifier() bridge, in the meantime.
@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…ring

ReadableSignal and Computed had identical inline listener plumbing (the
_listeners map, addListener/removeListener, dispose cleanup) and Signal held
hasListeners/notifyListeners. Extract it all into a single _SignalListeners<T>
helper; the classes now delegate to it. Also drop the dead fireImmediately
getter (always false, never overridden).

Behavior-preserving: the map dedup, the notifyListeners reentrancy snapshot,
and the observe()-backed auto-dispose semantics are unchanged.
Bump both packages to 3.0.0-dev.2 with CHANGELOG entries for the package:listen migration. flutter_solidart now requires solidart ^3.0.0-dev.2.
solidart_hooks 4.0.0-dev.2 and solidart_lint 3.1.0-dev.2, both requiring the new solidart/flutter_solidart ^3.0.0-dev.2 (package:listen migration).
The migration removed the file's opening coverage:ignore-start (it sat above the deleted VoidCallback) but left the closing coverage:ignore-end, which made the coverage tool throw 'unmatched coverage:ignore-end' during CI. Replace the start/end pair with the idiomatic // coverage:ignore-file directive.
@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (17d9b48) to head (c94a194).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #178   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           18        19    +1     
  Lines          892       923   +31     
=========================================
+ Hits           892       923   +31     
Files with missing lines Coverage Δ
packages/solidart/lib/src/core/computed.dart 100.00% <100.00%> (ø)
packages/solidart/lib/src/core/read_signal.dart 100.00% <100.00%> (ø)
packages/solidart/lib/src/core/signal.dart 100.00% <100.00%> (ø)
...ckages/solidart/lib/src/core/signal_listeners.dart 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant