Developer experience vs Juice
1. Landscape snapshot (versions/URLs read; the macros status finding stated plainly)
Read 2026-09-16. Juice baseline: /Users/kevinehmka/dev/juice at f301781 (juice 1.7.2, juice_lint 0.1.0 publish_to: none, juice_observability 0.5.0 + DevTools extension, skill bundle 0.1.0). Local SDK: Dart 3.12.2 / Flutter 3.44.4.
- Dart macros are cancelled. dart.dev/language/macros: work stopped 29 Jan 2025 (“too far away from shipping macros with the developer-time performance we require”). Replacements: language-level data support (primary constructors stable “as of Dart 3.13” per the freezed README), augmentations (“stands on its own and will improve existing code generation”), and build_runner performance work. Codegen packages remain the norm: freezed 4.0.1, riverpod_generator 4.0.9 (“entirely optional”).
- custom_lint 0.8.1 is “no longer under active development” (README, raw fetch); it recommends the official
analysis_server_plugin0.3.23 (tools.dart.dev, Dart ≥3.10), enabled via a top-levelplugins:key inanalysis_options.yaml, whose diagnostics are reported bydart analyze/flutter analyze(dart.dev/tools/analyzer-plugins). juice_lint is built on the abandoned host. riverpod_lint 3.1.9: 15 rules, 6 assists. bloc_lint 0.4.2: standalone linter on_fe_analyzer_shared(pubspec), run asbloc lint .. - DevTools: riverpod_devtools (graph, inspector, event log, MCP), signals_devtools_extension (“early”), Patrol (native UI tree for selectors), bloc_devtools_extension 0.2.0 (third-party, time travel + diff).
- Testing: bloc_test 10.0.0; riverpod 3.4.3
ProviderContainer.test();testWidgetsruns insideFakeAsync(api.flutter.dev); alchemist 0.14.0. Scaffolding: very_good_cli 1.5.0, mason, stacked_cli. - Migration:
lib/fix_data.yaml(flutter/flutter Data-driven-Fixes.md);pub upgrade --major-versions/--tighten. - Docs: docs.page (Invertase, free OSS, auto-llms.txt + MCP). DartPad: only gist iframes remain and only 36 whitelisted packages (bloc, riverpod, provider in; juice not importable).
- AI: llmstxt.org; agents.md (Linux Foundation, 60k+ repos); dart.dev/tools/pub/package-skills —
skills/<package>-<name>/SKILL.mdinside the pub package, bundled bydart pub publish, installed bydart run skills@ get(skills1.0.1, labs.dart.dev) into Claude Code/Cursor/Codex/Copilot/…; officialflutter/agent-plugins(Claude plugindart-flutter, 10 skills, rules, Dart MCP server).
2. Mechanism catalog — for EACH mechanism:
build_runner code generation (freezed / json_serializable / riverpod_generator)
- What it does / problem solved: generates
copyWith,==/hashCode,toString, unions, JSON and (riverpod) provider declarations from annotations. - How it works (the sophisticated part):
build_runnerruns eachBuilderover annotated inputs throughsource_gen’s resolved element model (types, not text), writingpartfiles the source must declare;watchis incremental via an asset graph. freezed’s copyWith solves nullable-clear with an internal sentinel — the_unsetproblem Juice documents by hand. riverpod_generator derives the provider kind from the return type. The cost is a second artifact that must be regenerated and kept in sync. - Juice today —
lacks(by decision). No build_runner/freezed/json_serializable in anypackages/*/pubspec.yaml; AGENTS.md §2 hand-writescopyWith+_unset;juice_mutable_state_fieldenforcesfinal. - Gap value — Med for app authors with many states (gotcha 6 is error-prone); Low for the framework.
- Adoption sketch — Build nothing. A one-paragraph “using freezed for a BlocState” note in AGENTS.md is S, after a spike confirming
@freezed class X extends BlocStateworks (unverified). - Doctrine fit — “code is the source of truth” forbids a Juice-owned generator; letting apps opt in costs nothing.
Lint packages with quick-fixes (custom_lint → analysis_server_plugin; riverpod_lint; bloc_lint)
- What it does / problem solved: framework idioms as IDE squiggles with one-click fixes.
- How it works (the sophisticated part): under custom_lint a
DartLintRule.runregisters AST visitors oncontext.registryand reports withreporter.atNode; a fix is aDartFix.run(resolver, reporter, context, analysisError, others)that callsreporter.createChangeBuilder(message:, priority:)thenaddDartFileEditto insert/replace source; aDartAssistattaches to aSourceRangeinstead (riverpod_lint’s “wrap with Consumer”). The analysis server runs the plugin in an isolate so IDEs show it, butflutter analyzenever reports it. The officialanalysis_server_pluginfixes this:Plugin.registerwith rules,registerFixForRule, assists, declared underplugins:, surfaced bydart analyze. bloc_lint went a third way — its own parser-level linter plus a CLI. - Juice today —
partial (no quick-fixes; abandoned host).packages/juice_lint/lib/src/*.dart: three rules, nogetFixes/DartFix/Assist(grepped); the rule file’s own comment says it is stuck on deprecated APIs “until custom_lint adopts the diagnostic API” — it never will. Dogfooded on five example apps viamelos run lint:juice;expect_lintfixtures inexample/lib/fixtures.dart. - Gap value — High for consumers and for Juice’s CI (rules would run under
flutter analyze). - Adoption sketch — Port to
analysis_server_plugin: M (three rules on the official API + one fix: insertfinal). Maintenance drops — one official API instead of custom_lint’s analyzer pins. Local SDK 3.12 ≥ 3.10. - Doctrine fit — Fail loud at edit time; rules derive from AGENTS.md, not a second truth. A fix must emit exactly the §2 shape.
DevTools extensions
- What it does / problem solved: a framework tab showing live state, transitions, dependencies, problems.
- How it works (the sophisticated part): the app posts
dart:developerpostEventon the extension stream (or registers service extensions); the extension — a Flutter web app declared inextension/devtools/config.yaml, built intoextension/devtools/build/— is discovered from the pub dependency, enabled once, and readsserviceManager.service.onExtensionEventor pulls on demand viacallServiceExtensionOnMainIsolate/EvalOnDartLibrary. The stream has no replay. The best panels add time-travel with diffs (bloc_devtools_extension), dependency graphs (riverpod, signals), and an MCP bridge (riverpod_devtools). - Juice today —
has.devtools_juice_logger.dartpostsjuice:<type>viadeveloper.postEvent;telemetry_store.dartlistens ononExtensionEvent; four views (Timeline, Spans, Blocs, Problems), live-verified in DevTools 2.57.0. Missing vs the best: state diff, a rebuild-group → widget view, any pull path (registerExtension: none). - Gap value — Med. Diff and “which widgets rebuilt for this group” would beat the field because groups are named intents.
- Adoption sketch — Diff view S–M (store already keeps the last summary). Group-rebuild view M — new core instrumentation (
widget_rebuilt{groups}fromStatelessJuiceWidget). Replay L and off-doctrine. Maintenance: a web app rebuilt per publish; config.yaml version drift already happened once. - Doctrine fit — Observability of the existing seam; skip time-travel.
Bloc test harness (blocTest / ProviderContainer.test / BlocTester)
- What it does / problem solved: seed, act, assert the exact emitted sequence, repeatably.
- How it works (the sophisticated part):
blocTest(build:, seed:, act:, wait:, skip:, expect:, errors:, verify:)builds the bloc in-test, seeds viaemit, subscribes, runsact, waits, then closes the bloc before evaluating so no late emission leaks;MockBloc+whenListenstub a stream and keepstatein sync for widget tests.ProviderContainer.test()isolates a container per test, disposes viaaddTearDown, and adds an end-of-test check that every container was disposed;container.listenrecords transitions. - Juice today —
has-under-another-name,partial (not declarative, no close-before-assert, no leak check, unused).packages/juice/lib/src/testing/bloc_tester.dart:BlocTesterrecords emissions,send()sleeps a fixed 10 ms,expectStatusSequence,waitForEmissions,dispose(). Used only byexample/test/features_showcase_test.dart; every package test uses the raw fake-the-seam +settle()pattern (AGENTS.md §6). - Gap value — Med–High; the 10 ms sleep is the flake blocTest was built to remove.
- Adoption sketch —
juiceTest(build:, seed:, act:, expect:, groups:)intesting.dart, asserting ongroupsToRebuild(Juice’s differentiator), closing before assert, with aBlocScope.enableLeakDetectioncheck: S–M, one file. - Doctrine fit — “Demonstrate in full”: adopt it in the package tests or don’t ship it.
Mocking, fake time, goldens (mocktail / FakeAsync / alchemist)
- What it does / problem solved: deterministic collaborators, clocks and pixels.
- How it works (the sophisticated part): mocktail stubs without codegen via
when(() => …)closures;FakeAsyncswaps the zone’s timer/microtask factories soelapse()/flushTimers()fire scheduled work synchronously —testWidgetsalready runs inside one,pump(Duration)advances it,runAsyncescapes; alchemist wraps goldens with text-obscured “CI goldens” to dodge font drift. - Juice today —
partial. mocktail is a dev dep in five packages (storage, network, auth, auth_network, auth_routing); doctrine prefers hand-written seam fakes. NoFakeAsyncin any test and nomatchesGoldenFile(grepped). - Gap value — Med for the timer-bearing packages (sync outbox, network retry, realtime reconnect); Low for goldens.
- Adoption sketch —
package:fake_asyncin those tests: S per package, no new API. Goldens: not for Juice. - Doctrine fit — Fakes over mocks is already doctrine; fake time is rigor.
Scaffolding CLIs and templates (very_good_cli / mason / stacked)
- What it does / problem solved: one command creates a package/feature in the house shape.
- How it works (the sophisticated part): a mason brick is
brick.yaml(typedvarswith prompts/defaults) plus a__brick__/tree whose file names and contents are mustache templates with case lambdas (``), partials, and Dartpre_gen/post_genhooks; distributed via BrickHub/git/path. very_good_cli layers opinionated bricks andvery_good test --min-coverage; stacked_cli editsapp.dartin place. - Juice today —
lacks. Nobrick.yaml/mason.yaml; the canonical shape exists as AGENTS.md §2 prose plus 24 real packages. - Gap value — Med for humans starting a
juice_foo; Low for agents (the skill emits the shape). - Adoption sketch — One
juice_packagebrick undertool/bricks/: S to write, but it is a second copy of §2. Only acceptable if its output is a checked-in fixture package that CI analyzes and tests, so the brick is proven not documented. Every core API change then touches both. - Doctrine fit — Borderline; gated as above or not at all.
Docs sites and interactive examples (docs.page / DartPad / Jekyll)
- What it does / problem solved: browsable, searchable docs with runnable snippets.
- How it works (the sophisticated part): docs.page renders MDX from a repo path with branch/PR previews, search, and per-site
llms.txt+ MCP. DartPad embeds are now gist-only iframes (dartpad.dev/?id=<gist>&theme=…) restricted to 36 whitelisted packages — a Juice snippet cannot run there. - Juice today —
has(Jekyll/just-the-docs via.github/workflows/jekyll-gh-pages.yml;doc/dated Jan 2025–Jun 2026;doc/api/dartdoc). Risk:doc/testing/bloc-tester.mddocuments a class no package uses; the human site has no drift check, unlike the cards. - Gap value — Low–Med; the cards + AGENTS.md are the real docs now.
- Adoption sketch — A
tool/check_docs.shgreppingdoc/for symbols absent fromlib/: S. DartPad: impossible. - Doctrine fit — Fine as-is; docs.page would be a second doc system plus a hosted dependency.
Migration tooling (fix_data.yaml / pub upgrade --major-versions)
- What it does / problem solved: consumers cross a breaking change with
dart fix --apply. - How it works (the sophisticated part): a package ships
lib/fix_data.yaml—version: 1,transforms:each withtitle,date, anelementselector (uris+class/method/field/inClass) andchangesof kindrename,addParameter,removeParameter,renameParameter,changeParameterType,replacedBy, with optionaloneOfandbulkApply; the analyzer matches usages in the consumer’s code and rewrites them; the package tests it withtest_fixes/<f>.dart+.dart.expectunderdart fix --compare-to-golden.pub upgrade --major-versionsrewrites constraints to whatpub outdatedreports resolvable;--tightenraises lower bounds to the resolved versions. - Juice today —
lacks. Nofix_data.yaml(find’d). Core carries@DeprecatedonRelayUseCaseBuilder(“Use StateRelay or StatusRelay… removed in v2.0.0”) and two inbloc_event.dart— exactly thereplacedByshape. Migrations are CHANGELOG prose. - Gap value — Med now, High the day v2.0.0 lands.
- Adoption sketch — One
fix_data.yaml+test_fixes/pair inpackages/juice: S; append per breaking rename; goldens catch rot.--tightenmechanizes docket §7’s “no floor is dishonest”. - Doctrine fit — Declarative, tested, no generated code.
Error UX (error boundaries, redbox, structured reporting)
- What it does / problem solved: a build-time throw becomes a readable, copyable panel; runtime failures carry context.
- How it works (the sophisticated part):
ErrorWidget.builderis Flutter’s global hook; frameworks wrapbuildin try/catch and render a boundary; observability layers chainFlutterError.onError/PlatformDispatcher.onError, attach breadcrumbs, fan out to reporters. - Juice today —
has.JuiceWidgetSupport.processWithErrorHandlingand threeJuiceBuildersites renderJuiceExceptionWidget(copy-to-clipboard, selectable trace, dismiss).juice_observabilityinstalls both global handlers, chains and restores prior ones, keeps a 50-entry breadcrumb ring, isolates reporter failures; use-case failures reach the DevTools Problems view. Verified gap: nokReleaseMode/kDebugModeanywhere underpackages/juice/lib/src/ui— a release user can see a stack trace. - Gap value — Low, but the release exposure is real.
- Adoption sketch — Release-mode fallback tile behind the existing widget: S. It is a default, so it needs Kevin’s ruling.
- Doctrine fit — Loud in debug and to the reporter; what the release user sees is a doctrine call.
Hot-reload friendliness (state preservation across reload)
- What it does / problem solved: edit-and-see without losing app state.
- How it works (the sophisticated part): hot reload swaps method bodies on the live heap; long-lived objects survive, constructor work does not re-run. Riverpod additionally re-executes only the provider whose source changed (riverpod_generator docs). Bloc instances live as long as their owning widget.
- Juice today —
haswith one undocumented nuance.BlocScope._entriesis astatic final Map, so registered blocs and state survive;execute()edits apply on the next event. ButJuiceBloc._registerUseCasesmaterializes the builder list once at construction (juice_bloc.dart:290-292) and there is noreassemblehook (grepped), so adding aUseCaseBuilderto a live bloc needs a hot restart — the same “my event does nothing” symptom as the generic-event gotcha. - Gap value — Low–Med; one sentence saves a confused session.
- Adoption sketch — Add to AGENTS.md gotchas: S. Re-registering on
reassembleis a new dev-only code path — skip. - Doctrine fit — Documentation only.
AI-agent affordances (llms.txt / AGENTS.md / package skills / Claude plugin)
- What it does / problem solved: a framework absent from training data still gets written correctly.
- How it works (the sophisticated part): llms.txt is H1 + blockquote + H2 link lists; AGENTS.md is a “README for agents”, nearest-file-wins, read by Codex/Cursor/Copilot/Jules/Gemini CLI; the Dart-official channel is package skills —
skills/<package>-<name>/SKILL.mdinside the pub package, bundled bydart pub publish, discovered from the consumer’s dependency tree bydart run skills@ getand installed into every major agent’s skills directory. The official Flutter Claude plugin adds rules, skills and the Dart MCP server. - Juice today —
has(ahead of most),partialon the pub channel. Verified: rootAGENTS.md, spec-conformantllms.txt, 24 versioned cards,check_cards.sh,sync_skill.sh --check, Claude plugin (.claude-plugin/,skills/juice/SKILL.md). Gap: the skill sits at the monorepo root, not inpackages/juice/skills/, and is namedjuice— the spec requiresjuice-<name>and the installer “skips non-conforming skills”.dart run skills@ getin a consumer finds nothing; only Claude-marketplace users get it. No Cursor/Codex rule files. - Gap value — High: the pub channel is agent-agnostic, zero-install, and the one dart.dev documents.
- Adoption sketch — Emit the bundle to
packages/juice/skills/juice-framework/fromsync_skill.sh; point.claude-pluginat it: S–M; maintenance unchanged. - Doctrine fit — Exact: doctrine stays in AGENTS.md/cards; skills remain drift-checked copies.
3. Not worth adopting (one line each with the reason)
- A
juice_generator/ freezed-style codegen forBlocState: generated code is a second truth plus a build_runner dependency; the lint already enforces the shape. - DevTools time-travel / replay: re-emitting state outside a use case breaks event-in/state-out.
- DartPad embeds: Juice is not on the 36-package whitelist.
- docs.page: a hosted second doc system; the cards are already the AI surface.
- A very_good_cli-style umbrella CLI: a whole tool for one template.
- bloc_lint’s standalone-linter approach: reimplementing analysis on
_fe_analyzer_sharedis a maintenance sink now that the official plugin API reports from the CLI. MockBloc/whenListenmock blocs: a real bloc with a fake seam is the cheaper, truer double.- Golden tests: Juice ships no visual components.
4. Top 5 recommendations, ranked, one paragraph each, with the gate that should precede building
-
Port
juice_linttoanalysis_server_plugin, add its first quick-fix. custom_lint is abandoned by its own README, the rule file already admits it is stuck on deprecated APIs, and the official host reports diagnostics fromflutter analyze— somelos run analyzeand CI would enforce the rules instead of a side script. Add one fix (juice_mutable_state_field→ insertfinal) to prove the fix path. Gate: confirm consumers (Amoli) are on Dart ≥3.10, and re-run the docket §5 planted-sentinel test under the new host before deleting the custom_lint version. -
Ship the skill through the pub package-skills channel. Have
sync_skill.shemitpackages/juice/skills/juice-framework/sodart run skills@ getinstalls it into Claude Code, Cursor, Codex, Copilot and the rest from the dependency tree, with the sync script still the only writer. Gate: prove on a scratch consumer that theskillsCLI accepts the name and thatdart pub publish --dry-runbundles the directory cleanly. -
Add
lib/fix_data.yamlfor the existing deprecations. Three@Deprecatedmembers already promise v2.0.0 removal; encode them asreplacedBy/renametransforms with atest_fixes/golden sodart fix --applycarries consumers over. Gate: Kevin confirms the v2 removal list is final. -
A declarative
juiceTest, adopted by the packages.BlocTesteris unused and sleeps 10 ms; ablocTest-shaped helper that closes before asserting, asserts ongroupsToRebuild, and runs aBlocScopeleak check would be the harness the family actually uses. Gate: migrate juice_theme and juice_sync (both just touched); keep it only if it removessettle()calls rather than adding a layer. -
DevTools state diff + group-rebuild view; document the hot-reload nuance. A diff of consecutive Blocs summaries is small; a
widget_rebuilt{groups}event fromStatelessJuiceWidgetwould make Juice the only framework whose DevTools explains why a widget rebuilt, by name. Gate: it is new core instrumentation — approve the event schema, confirm it is a no-op withoutDevtoolsJuiceLogger, measure overhead on notes_app. The AGENTS.md sentence (“new builders need a hot restart”) needs no gate.
5. Things Juice already does BETTER on DX than most of the ecosystem (be specific)
- A drift-checked AI documentation system: 24 per-package cards on a versioned schema,
check_cards.shfailing on version/requiresdrift,sync_skill.sh --checkfailing when skill copies diverge. Neither bloc nor riverpod ships per-package AI cards; docs.page generates an llms.txt, Juice curates one. - Gotchas-as-lints with a proof fixture: each rule cites the AGENTS.md section it encodes, and
fixtures.dartis a self-verifyingexpect_lintsuite; riverpod_lint has more rules but no doctrine trace per rule. - A DevTools extension that is a decorator on an existing seam:
DevtoolsJuiceLogger(inner:)wraps the logger; theexecutionId-paired spans withelapsedMicroswere already logged. bloc has no official extension; riverpod’s needs an observer plus a CLI static-analysis step. - The canonical package shape is real, 24 times: every
juice_*is the same skeleton, so agents copy a demonstrated package rather than a generated one. - A shipped error boundary:
JuiceExceptionWidgetwith copy-to-clipboard wired into all three builder paths; most state libraries leaveErrorWidget.builderto the app. - Publish hygiene that has caught real drift:
cards:check“caught four real drifts” on its first run;panachecks none of this.