v7: scoped BLoC/Cubit support, docs MCP server & site, release 7.0.1#1057
Merged
Conversation
Simple project overview, v7 API idioms, DO/DON'T lists, and reminders — notably: editing doc/docs requires rebuilding & republishing the tool/docs_mcp server (docs are embedded at build time). Exclude CLAUDE.md from the pub.dev archive. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Decouple the exposed page-scoped value from its rebuild trigger so `context.watch<T>()` can return any object (e.g. a BLoC/Cubit) while rebuilds are driven by a separate Listenable. `_VMInherited<T>` now extends `InheritedNotifier<Listenable>` carrying both `value` (the T) and a separate trigger, reusing the InheritedNotifier rebuild machinery. New `Scoped` API: - addStreamable<T>(ctor, (t) => t.stream, (t) => t.close()) — reactive via a Stream property; exposes the object itself (BLoC/Cubit and the like). Uses an internal notify-only `_StreamTrigger`; flutter_modular keeps no dependency on the `bloc` package (stream/close are caller callbacks). - addListenable<T>(ctor, (t) => t.listenable, (t) => t.dispose()) — reactive via a Listenable property. - addChangeNotifier reexpressed as a thin wrapper over addListenable. - add<T>(ctor) — non-reactive object, exposed via read/watch and disposed on unmount iff it implements Disposable. Replaces addDisposable (removed; Disposable interface retained). dispose callbacks are FutureOr (fire-and-forget for async close()); the host cancels the stream trigger before user dispose, guards against duplicate page-scoped types, and runs every spec's dispose on unmount. `watch`/`read`/`Consumer`/`Selector` relax their bound to `Object` and subscribe to the trigger via an `@internal` accessor. Docs: frame addChangeNotifier/addStream as the rule and addStreamable/addListenable as exceptions; add a "BLoC and Cubit" section with an example and a suggested `addBloc` extension. Regenerate the docs MCP index. Migrate the example and tests off addDisposable; add streamable/listenable/simple-add coverage. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Re-embed the refreshed state-management docs (addStreamable/addListenable escape hatches + BLoC/Cubit registration). Bump version in pubspec.yaml and serverVersion. Also restore granular tool/ exclusions in the root .pubignore: a blanket `tool/` rule is applied to the nested package on publish and silently strips all its files, producing an empty archive. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Page-scoped BLoC/Cubit support (addStreamable/addListenable) and add<T> replacing addDisposable — missed in the 7.0.0 release. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Batch of v7 work since the last
v7 → mastermerge (#1055).Package — flutter_modular 7.0.1 (published)
Scoped.addStreamable<T>(ctor, (t) => t.stream, (t) => t.close())exposes the object itself viacontext.watch<T>()(read its synchronousstate) while rebuilds are driven by its stream — no dependency on theblocpackage. CompanionaddListenable<T>for objects whose reactivity is aListenableproperty.add<T>(ctor)replacesaddDisposable(removed;Disposableinterface kept): a non-reactive page-scoped object, readable viaread/watch, disposed on unmount iff it implementsDisposable.addChangeNotifierreexpressed overaddListenable;watch/read/Consumer/Selectorrelaxed to accept anyObject(decouples the exposed value from the rebuild trigger). Full backward compat; 53 tests green.7.0.1on pub.dev.Tooling / repo
flutter_modularv7 package (depends directly onauto_injector+web;modular_coregone).tool/docs_mcp(flutter_modular_docs_mcp) — embeds the docs at build time, servessearch_docs/read_doc; releases v0.2.0 → v0.2.1..pubignoretuned so nestedtool/packages still publish; rootCLAUDE.mdmaintainer guide.Docs
addChangeNotifier/addStreamas the rule andaddStreamable/addListenableas exceptions, with a BLoC and Cubit section and a suggestedaddBlocextension.🤖 Generated with Claude Code