The rest of the sophisticated approaches vs Juice
Baseline read: /Users/kevinehmka/dev/juice at juice 1.7.2 — AGENTS.md, ROADMAP.md, llms.txt, core README, bloc/src/core/*, use_case_builders/src/*, bloc_scope.dart, lifecycle/*, state_selector.dart, entity_status.dart, testing/bloc_tester.dart, plus juice_storage/lib/src/core/{bloc_result_ops,result_event,operation_result}.dart, juice_forms/lib/src/forms_bloc.dart, and the DevTools extension views.dart. Every “Juice today” names the file or grep behind it. Dates relative to 2026-09-16.
1. Family snapshot (versions read, URLs, one-paragraph philosophy per package)
- mobx 2.7.0 / flutter_mobx 2.4.0 (~5 days old; https://pub.dev/packages/mobx, /flutter_mobx; source read
mobx/lib/src/core/{reaction,context,computed}.dart,flutter_mobx/lib/src/observer_widget_mixin.dart). Transparent reactivity: observables,@computed(“what can be derived, should be derived”),autorun/reaction/when,Actionas the batching mutation boundary. Dependencies are discovered by reading, never declared. - redux 5.0.0 / flutter_redux 0.10.0 / redux_dev_tools 0.7.0 (4–5 years old; https://pub.dev/packages/redux, /flutter_redux, /redux_dev_tools). Single store, pure reducers,
Middleware = (Store, action, NextDispatcher next),StoreConnector(converter, distinct). Dormant, but the reference Dart time-travel. - async_redux 28.4.0 (~2 days old; https://pub.dev/packages/async_redux, https://asyncredux.com/flutter/basics/wait-fail-succeed/, source read
lib/src/store.dart). Each action is a class withbefore/reduce/after/wrapError; the store tracks in-flight and failed actions by type so widgets askisWaiting(MyAction). - stacked 3.5.0 / stacked_generator 2.0.4 / stacked_cli (13 and 3 months; https://pub.dev/packages/stacked, /stacked_generator, https://stacked.filledstacks.com/docs/tooling/stacked-cli). MVVM on
ChangeNotifier, busy/error keyed by object, get_it underneath, a CLI that scaffolds view+viewmodel+test and editsapp.dartat marker comments. - rearch 1.16.1 (17 months; https://pub.dev/packages/rearch; source read
packages/rearch/lib/{rearch,src/side_effects}.dart). Capsules are functions of aCapsuleHandle; side effects compose; a dataflow graph rebuilds dependents; “idempotent” capsules are disposed automatically. - get_it 9.2.1 / injectable 3.0.0 (6 and 4 months; https://pub.dev/packages/get_it, /injectable; README read). Locator with a scope stack, async singletons with
dependsOn/allReady, annotation codegen. - fpdart 1.2.0 / dartz 0.10.1 (10 months; dartz 4 years, unverified uploader; https://pub.dev/packages/fpdart, /dartz).
Either,Option,TaskEither.tryCatch, Do-notation: failures as values. - flutter_command 7.2.2 (discontinued) → command_it 9.5.1 (6 months; https://pub.dev/packages/command_it, https://pub.dev/documentation/command_it/latest/command_it/Command-class.html). A
Commandpublishesvalue,results,isRunning,canRun,errorsasValueListenables; restriction, error filters, undo, progress. - elementary 3.2.1 / elementary_test 2.1.1 (14 months; https://pub.dev/packages/elementary, /elementary_test). MWWM:
ElementaryWidget→WidgetModel→ElementaryModel;EntityStateNotifier;testWidgetModel. - very_good_cli 1.5.0 / mason_cli 0.1.4 / feature_brick 0.6.2 (8 days / 19 hours / 3 years; https://pub.dev/packages/very_good_cli, /mason_cli, https://brickhub.dev/bricks/feature_brick, https://cli.vgv.dev/docs/templates/core). Mustache bricks generate a feature folder or a whole app (three flavors,
BlocObserver, l10n, coverage, CI).
2. Mechanism catalog
Auto-tracked derivations and reactions (MobX)
- What it does / problem solved:
Observerandreactionre-run only when an observable they actually read changes;@computedcaches derived values. - How it works:
Computedis bothAtomandDerivation; observed, it recomputes only when_context._shouldCompute(this)reports a stale dependency and usesequalsto suppress no-op propagation; unobserved and outside a batch it recomputes on every read. Propagation is two-phase —propagateChanged()marksstale,_propagatePossiblyChanged()markspossiblyStaleso a computed verifies before observers run.ActionwrapsstartBatch/endBatch; reactions queue viaaddPendingReactionand run when the batch counter hits zero, guarded bymaxIterations(100) →MobXCyclicReactionException.Observerbuilds insidereaction.track(() => super.build()), invalidates viamarkNeedsBuild, warns when!reaction.hasObservables. - Juice today:
has-under-another-namefor the widget effect — rebuild groups (widget_support.dart: denyRebuild, set intersection) plusbloc.select/JuiceSelector/JuiceSelectorWith(state_selector.dart,==or customequals).lackscomputed caching (grepcomputed|derived|memoizinpackages/juice/lib: doc comments only). - Gap value: Low for tracking (groups are explicit by doctrine); Med for a memoised projection helper.
- Adoption sketch: no graph. Note ROADMAP #2 (“
SelectJuiceWidget/.select<T>”) is 📋 whileJuiceSelector+bloc.selectalready ship — the discoverability situation item #4 turned out to be. Cost S (docs). - Doctrine fit: auto-tracking conflicts; reconciling ROADMAP #2 with the shipped selector fits.
Per-action-type waiting/failed queries (async_redux)
- What it does / problem solved: any widget asks
context.isWaiting(LoadText),isFailed(LoadText),exceptionFor(LoadText)— no busy flag threaded through state. - How it works:
StorekeepsHashSet<ReduxAction> _actionsInProgress(added in_calculateIsWaitingIsFailed(), removed in_finalize()) andMap<Type, ReduxAction> _failedActionswritten in_processError().isWaiting(Object actionOrTypeOrList)matches byruntimeTypefor aType, identity for an instance, any-of for an iterable. Re-dispatching a type clears its failed entry;clearExceptionForclears manually; onlyUserExceptioncounts as failed. Types queried are recorded in_awaitableActionsso the store rebuilds the right widgets.dispatchAndWaitreturnsFuture<ActionStatus>(isCompletedOk,originalError,wrappedError,hasFinishedMethodBefore/Reduce/After,isDispatchAborted). - Juice today:
partial.StreamStatusis bloc-wide;EntityStatuses<K>+guardEntity(entity_status.dart,bloc_use_case.dart) is per-entity, keyed by the app’s key not event type. The dispatcher’s_running: Map<Type,bool>(event_dispatcher.dart) is private and set only fordroppable.sendAndWait(juice_bloc.dart) resolves on the first non-waiting status of any event. - Gap value: Med-High —
juice_permissionshand-rollsMap<JuicePermission, Completer<PermissionStatus>> requestsInFlight;juice_formspassesCompleter<bool>fields onValidateFormEvent/SubmitFormEvent. - Adoption sketch:
bloc.isRunning(Type)andbloc.lastFailure(Type)(cleared on next dispatch of that type) maintained inUseCaseExecutor.executearound the existing start/end pair, surfaced as an emission so groups can subscribe. Packagejuice, cost M. - Doctrine fit: fits (read-only, no logic leaves the use case); one knob ruling — is
lastFailurestate or status.
Lifecycle hooks and behavioural mixins (async_redux)
- What it does / problem solved:
before/reduce/after/wrapError/wrapReduce/abortDispatchper action; mixinsNonReentrant,Retry/UnlimitedRetries,Debounce,Throttle,Fresh(freshFor),Polling,CheckInternet,OptimisticCommand. - How it works: the dispatch pipeline calls hooks in order (
after()sync-only, always runs); a mixin overridesabortDispatch/wrapReduce—NonReentrantaborts whenisWaiting(runtimeType),Debounceholds a per-type timer,Retryre-runsreducewith backoff.globalWrapError,errorObserver,actionObservers,stateObserverare store-level lists. - Juice today:
hasconcurrency (EventConcurrency≈NonReentrant;restartableplanned, ROADMAP #3),hasretry (RetryableUseCaseBuilder+BackoffStrategy),hasglobal error (BlocErrorHandler).lacksdebounce/throttle/fresh/polling (grepdebounce|throttleinpackages/juice/lib: none). Nobefore/afterby design. - Gap value: Med for debounce/throttle (same typeahead consumer as
restartable); Low forFresh/Polling(a timestamp in state). - Adoption sketch:
UseCaseBuilder(debounce: Duration)implemented inEventDispatcherbeside_tails/_running, shipped withrestartable. Packagejuice, cost M. - Doctrine fit: needs a knob — same gate as
restartable: a real consumer.
Middleware chain and observers (redux, async_redux)
- What it does / problem solved: cross-cutting logging, persistence, gating on every action without touching reducers.
- How it works: each
Middlewarecallsnext(action)to continue or swallow; async_redux replaces the chain with typed observer lists and apersistorfed every state change. - Juice today:
has-under-another-name (JuiceLogger + UseCaseExecutor). Every execution funnels throughUseCaseExecutor.execute(start/complete/error sharingexecutionId) and every emission throughStatusEmitter._emit(state_emissionwithgroups);JuiceLoggerConfig.configureLoggerswaps the sink. No way to block or rewrite an event in flight. - Gap value: Low. Observation is richer than redux’s; interception conflicts with one-use-case-per-event.
- Adoption sketch: none; a persistor is a
StateRelayintojuice_storage, which exists. Cost 0. - Doctrine fit: interception conflicts; observers fit and exist.
Time-travel / undo (redux_dev_tools, command_it)
- What it does / problem solved: step through state history in dev; undo a user action at runtime.
- How it works:
DevToolsStorekeepsDevToolsState(computedStates: List<S>, stagedActions, currentPosition)plussavedState/latestAction;DevToolsActions movecurrentPosition, andstateiscomputedStates[currentPosition]— possible only because reducers are pure. command_it’screateUndoable*takes an undo function and anUndoStack, withundoOnExecutionFailurerolling back when the handler throws. - Juice today:
lacks(grepundo|redo|history|snapshotinpackages/juice/lib: none; family hits arejuice_routing’s stack). The extension hasTimelineView/BlocsView/ProblemsView(views.dart), no diff or replay (noDiffclass injuice_observability*/lib). Use cases call seams, so replay would re-fire side effects; compensating undo is feasible. - Gap value: Med for a dev-time state ring buffer (
state_emissionalready carriesstate.toString()); Low for runtime undo. - Adoption sketch: (a)
juice_observability: last NStreamStatusper bloc inTelemetryStore, prev/current side by side, cost S. (b)UndoableUseCasemixin returning a compensatingEventBasepushed on a boundedUndoStack;bloc.undo()sends it. Cost M, gate on a consumer. - Doctrine fit: (a) fits; (b) needs a knob and a ruling that undo is an event, not a rewind.
ViewModel busy/error by object; reactive services (stacked)
- What it does / problem solved:
setBusyForObject(key),busy(key),runBusyFuture(future, busyObject:),setErrorForObject,hasErrorForKey;ReactiveViewModel.listenableServicesre-notifies when aListenableServiceMixinservice changes. - How it works:
BaseViewModelkeeps busy/error maps keyed by object identity and callsnotifyListenersaround the future;ReactiveViewModelattachesnotifyListenersto each declared service, detaching indispose(API docs; source fetch 404’d — unverified at the implementation level). - Juice today:
has-under-another-name—EntityStatuses<K>+guardEntityisrunBusyFuture(busyObject)with a failure surface and guaranteed cleanup;StateRelay/EventSubscriptionreplacelistenableServices. - Gap value: Low. Juice’s is strictly stronger.
- Adoption sketch: none. Doctrine fit: n/a.
Capsules with graph-derived garbage collection (rearch)
- What it does / problem solved: state and logic as composable functions; lifetime derived from the dependency graph, not declared.
- How it works:
CapsuleContainer._capsules: Map<_UntypedCapsule, _CapsuleManager>created viaputIfAbsent;use(other)records an edge in aDataflowGraphNode; side-effect state is stored through the primitiveregister; a capsule is disposed whencapManager.isIdempotent && capManager.hasNoDependents(asListenerregisters an empty effect to pin one).runTransactioncoalesces updates into “a single container rebuild sweep” (buildNodesAndDependents).use.mutationreturns(state: AsyncValue?, mutate, clear). Flutter:RearchConsumer.build(context, WidgetHandle use). - Juice today:
partial.BlocScopederives lifetime from leases (leaseCount, auto-close on last release) andFeatureScope— explicit, not graph-derived. No transactional multi-bloc emit;StateRelaychains are microtask-delayed. - Gap value: Low-Med. Graph disposal is the novel bit; the lifecycle enum is Juice’s deliberate answer. Batching several blocs’ emissions into one frame is the piece with UI value.
- Adoption sketch:
BlocScope.batch(() {...})deferringStateManagerdelivery until the closure ends;state_manager.dart, cost S-M, gate on an observed double-paint. - Doctrine fit: capsules conflict; batching fits.
Scope stack, async-ready singletons, codegen registration (get_it + injectable)
- What it does / problem solved:
pushNewScope(scopeName:, init:, dispose:, isFinal:)/popScope()/popScopesTill/dropScope, shadowing, reverse-order disposal;registerSingletonAsync(dependsOn:, signalsReady:),isReady<T>(),allReady(timeout:),getAsync,WillSignalReady;registerFactoryParam, named instances,Disposable,resetLazySingleton. injectable emitsGetIt.init()from@injectable/@lazySingleton/@preResolve/@Scope/@Order/@Environment/@postConstruct/@disposeMethod. - How it works: scope frames searched newest-first; async singletons form a wait-graph so
allReady()completes when everydependsOnchain has signalled. - Juice today:
partial.BlocScoperegisters onlyT extends JuiceBloc<BlocState>keyed byBlocId(type, scope)— no services, no names;permanent/feature/leased;FeatureScope≈ named scope withCleanupBarrier(timeout, failure count) — better than get_it’sdispose;leaseAsyncwaits onclosingFuture. NoallReady: the idiom iswithConfigsending anInitialize*Event(droppable). Services travel inFooConfigseams.BlocDependencyResolver/CompositeResolver/GlobalBlocResolveralready let an app plug get_it or Modular in for bloc resolution. - Gap value: Med. Real pain: (1) no “substrate initialised” gate — apps hand-await
StorageBloc.initialize()chains; (2) no shadowing — tests cannot override a permanent registration (registerthrows on lifecycle mismatch, else no-ops). - Adoption sketch: (1)
BlocScope.whenReady<T>()/allReady()completed by the init use case’sResultEvent(already returned byInitializeStorageEvent); (2)@visibleForTesting BlocScope.override<T>(factory). Packagejuice, cost M. Services stay in seams. - Doctrine fit: (1) fits (fail-loud
get<T>()before ready); (2) needs a knob, test-only.
Commands as listenables (command_it)
- What it does / problem solved:
Command.createAsync(handler, initialValue:, restriction: ValueListenable<bool>, ifRestrictedRunInstead:, errorFilter:, notifyOnlyWhenValueChanges:, debugName:)exposesvalue,results: CommandResult(paramData, data, error, isRunning),isRunning,isRunningSync,canRun,errors;runAsync()returns a Future;createAsyncWithProgress(ProgressHandle);cancel();globalErrorHandler,loggingHandler;CommandBuilder;pipeToCommand();MockCommand. - How it works: a
ValueNotifierover the last result; running togglesisRunning; exceptions route through anErrorFilter(local listener / global / rethrow) instead of onecatchAlwaysbool;canRun = !isRunning && !restriction. - Juice today:
partial.ResultEvent<T>(lifecycle/scope_events.dart:succeed/fail/result/isCompleted) is the typed-return primitive but core has no helper to await it against the status stream;juice_storagere-implements it asStorageResultEvent(+requestId) withsendAndWaitResult/sendForResult/OperationResult(core/bloc_result_ops.dart, instance-filtered viaidentical(s.event, event));juice_formsuses bareCompleter<bool>fields (validateNow/submitNow);juice_permissionsaCompletermap. CoresendAndWaitis not instance-filtered.CancellableEvent+TimeoutSupportexist; restriction ≈droppable+ state check; no progress primitive. - Gap value: High. Four “event returns a value” implementations in one family is the clearest “no parallel code paths” violation found.
- Adoption sketch: promote
juice_storage’s trio into core:ResultEventgainsrequestId;JuiceBloc.sendForResult<T>/sendAndWaitResult(instance-filtered, timeout) injuice_bloc.dart;OperationResultto core; migrate storage/forms/permissions. OptionalProgressEventmixin viaemitWaiting.juice 1.8.0, cost M. - Doctrine fit: fits every rule.
Failures as values (fpdart / dartz)
- What it does / problem solved:
Either<Failure, T>,TaskEither.tryCatch,match/foldmake the failure type part of the seam signature. - How it works: sum types with
map/flatMapand Do-notation (Either.Do(($) => …)). - Juice today:
lacksa Result type (grepEither<|class Resultinpackages/*/lib: none). Failure travels asObject? erroronFailureStatus,EntityFailure(error),OperationResult.error. - Gap value: Low-Med; Dart 3 sealed classes give the same with no dependency.
- Adoption sketch: per-package
sealed class FooFailureon the seam,FailureStatus.errortyped by convention. Cost S. - Doctrine fit: fits; an FP dependency would add a second error channel.
WidgetModel triad and lifecycle testing (elementary)
- What it does / problem solved:
WidgetModelwithinitWidgetModel/didUpdateWidget/didChangeDependencies/deactivate/activate/dispose,onErrorHandlefromElementaryModel.handleError;EntityStateNotifierloading/error/content;testWidgetModel(setupWm, (wm, tester, context) …)drives the lifecycle against a mocked context. - How it works: the element owns the
WidgetModel, which owns the model; builders subscribe toStateNotifiers. - Juice today:
has-under-another-name—StatelessJuiceWidget.onInit/onStateChange/close,JuiceBuilder.onInit/onDispose,JuiceWidgetState1–3;StreamStatus=EntityState.BlocTestercovers blocs only. - Gap value: Low, except widget-lifecycle testing.
- Adoption sketch:
JuiceWidgetTesterintesting/pumping aStatelessJuiceWidgetunder a fake bloc and asserting rebuilds per group. Cost S-M. - Doctrine fit: fits.
Feature scaffolding (stacked_cli, very_good_cli, mason bricks)
- What it does / problem solved:
stacked create view loginwrites view + viewmodel +test/viewmodels/and inserts the route at// @stacked-route/// @stacked-import;very_good create flutter_appyields flavors,BlocObserver, l10n, CI, coverage;feature_brickemits bloc/event/state,view/*_page.dart,widgets/*_body.dart, barrels, tests fromfeature_name/state_management/use_equatable. - How it works: mason renders
__brick__mustache with case transforms,pre_gen/post_genDart hooks, conflict strategies; stacked patches marker comments so registration is automatic but optional. - Juice today:
lacks. AGENTS.md §2 is the template in prose and the skill (skills/juice,tool/sync_skill.sh --check) ships it to agents; no brick, no CLI, nomelos run new:package. - Gap value: High — 24 packages hand-shaped; the 2026-09-15 card-drift audit is the drift a generator prevents.
- Adoption sketch:
juice_featurebrick intool/bricks/(varsfeature_name,seam,lifecycle,concurrencyper event) emitting the §2 skeleton, a fake seam, a headless test withsettle(), anLLM.mdstub, acustom_lintblock; ajuice_packagebrick for the family. Cost M. - Doctrine fit: fits (“demonstrate in full” becomes generated).
3. Not worth adopting
- MobX auto-tracking /
Observer: replaces the groups vocabulary with implicit dependencies. - redux middleware
next(action): interception outside the use case breaks one-use-case-per-event. - redux_dev_tools replay: needs pure reducers; Juice use cases call seams.
- rearch capsules /
WidgetHandle: a different doctrine, not a gap. - get_it as a service container: seams travel via
FooConfig; a locator is a second resolution path besideBlocScope. - injectable codegen: nothing to annotate once blocs are the only registered type.
- dartz: unmaintained; fpdart as a dependency: a second error channel next to
FailureStatus. - stacked
ReactiveViewModel/ListenableServiceMixin: relays do this without listeners. - elementary’s
WidgetModellayer: a third class the widget/use-case split does not need. - command_it
restriction: ValueListenable<bool>:droppableplus a state predicate covers it.
4. Top 5 recommendations, ranked
-
Unify “event returns a value” in core (command pattern). Promote
juice_storage’ssendForResult/sendAndWaitResult/OperationResultandrequestIdonto coreResultEvent, instance-filter withidentical(status.event, event), keep the 30 s timeout loud, then migratejuice_storage,juice_forms(Completer<bool>fields) andjuice_permissions(Completermap). Three parallel paths become one and every bloc gets a typed command surface comparable to command_it’srunAsync()and async_redux’sdispatchAndWait → ActionStatus. Gate: show the four implementations side by side and get sign-off thatOperationResult’s shape is the one; ship asjuice 1.8.0with all three migrations. -
A
juice_featuremason brick (andjuice_package). The canonical shape exists as prose and skill; a brick makes it mechanical and enforces what prose cannot — explicitconcurrency:on every generated builder, a fake for every seam, anLLM.mdstub thattool/check_cards.shpolices. Gate: generatenotes_app’s notes feature and diff against the hand-written one — zero semantic diff is the acceptance test; decidetool/bricks/vs BrickHub. -
Per-event-type running/failure queries from the executor.
bloc.isRunning(SaveEvent)andbloc.lastFailure(SaveEvent)(cleared on next dispatch of that type, async_redux’s rule) computed inUseCaseExecutor.executearound the existingexecutionIdspan and surfaced as an emission. Read-only; no logic moves. Gate:juice_permissions’requestsInFlightmap must become deletable, or don’t build. -
BlocScope.whenReady<T>()/allReady()and a test-onlyoverride<T>(). get_it’sdependsOn/allReadysolves the boot sequencing every Juice app hand-writes; theResultEventfromInitialize*Eventis the ready signal already.overridegives tests shadowing without touchingregister’s mismatch throw. Gate: enumerate the boot sequence in the five example apps; if fewer than three await more than one init in order, ship onlyoverride. -
DevTools state history (read-only) and a
JuiceWidgetTester. Keep the last NStreamStatusper bloc inTelemetryStore, show prev/current side by side — the honest subset of time-travel for impure use cases, zero core cost. Pair with atesting/helper that pumps aStatelessJuiceWidgetagainst a fake bloc and asserts which groups rebuilt — the one test the groups doctrine still cannot write. Gate: publishjuice_observability 0.4.0first (committed, unpublished — ROADMAP docket #3).
5. Things Juice does BETTER than this family
- Per-event concurrency as a declared mode.
EventConcurrency.sequential/droppable/concurrentper type (event_dispatcher.dart: _tails/_running), audited across all 24 packages; async_redux needs aNonReentrantmixin per action, MobX/stacked/rearch have nothing. - Per-entity async status with guaranteed cleanup.
EntityStatuses<K>+guardEntitycarries the error per key and clears on throw; stacked’ssetBusyForObjecthas no per-key failure surface, command_it tracks one command. - Ownership lifecycles with a cleanup barrier. Leases,
leaseAsynconclosingFuture,FeatureScope.end()→CleanupBarrier.wait(timeout)with failure counts,LeakDetector; get_it’spopScopehas no timeout or leak report, rearch’s GC is opaque. - Emission telemetry as spans. Start/complete/error sharing
executionIdwithelapsedMicros, every emission logging its groups, rendered in DevTools; redux logging middleware and MobXspygive events, not spans. - Named rebuild groups as a reviewable contract. Which groups a use case emits and a widget subscribes to is readable in source; MobX’s tracked set and rearch’s graph exist only at runtime.
- Seams with shipped defaults and fakes as a family rule. Every vendor boundary is an interface with a default and a fake; the compared packages leave this to the app.
- Agent-readable doctrine that travels. AGENTS.md, per-package
LLM.mdcards with drift checks, an installable skill — none of the compared packages ship an equivalent, and it is why every “Juice lacks X” above was grep-verifiable in minutes.