Skip to content

v7: scoped BLoC/Cubit support, docs MCP server & site, release 7.0.1#1057

Merged
jacobaraujo7 merged 5 commits into
masterfrom
v7
Jun 23, 2026
Merged

v7: scoped BLoC/Cubit support, docs MCP server & site, release 7.0.1#1057
jacobaraujo7 merged 5 commits into
masterfrom
v7

Conversation

@jacobaraujo7

Copy link
Copy Markdown
Contributor

Batch of v7 work since the last v7 → master merge (#1055).

Package — flutter_modular 7.0.1 (published)

  • Page-scoped BLoC/Cubit support. Scoped.addStreamable<T>(ctor, (t) => t.stream, (t) => t.close()) exposes the object itself via context.watch<T>() (read its synchronous state) while rebuilds are driven by its stream — no dependency on the bloc package. Companion addListenable<T> for objects whose reactivity is a Listenable property.
  • add<T>(ctor) replaces addDisposable (removed; Disposable interface kept): a non-reactive page-scoped object, readable via read/watch, disposed on unmount iff it implements Disposable.
  • addChangeNotifier reexpressed over addListenable; watch/read/Consumer/Selector relaxed to accept any Object (decouples the exposed value from the rebuild trigger). Full backward compat; 53 tests green.
  • Released as 7.0.1 on pub.dev.

Tooling / repo

  • Flatten the monorepo into the single flutter_modular v7 package (depends directly on auto_injector + web; modular_core gone).
  • Docs MCP server under tool/docs_mcp (flutter_modular_docs_mcp) — embeds the docs at build time, serves search_docs/read_doc; releases v0.2.0 → v0.2.1.
  • .pubignore tuned so nested tool/ packages still publish; root CLAUDE.md maintainer guide.

Docs

  • Rewrite for v7, Docusaurus upgraded to 3.10, new brand identity; README + Docker for the docs site. State-management page now documents addChangeNotifier/addStream as the rule and addStreamable/addListenable as exceptions, with a BLoC and Cubit section and a suggested addBloc extension.

🤖 Generated with Claude Code

jacobaraujo7 and others added 5 commits June 22, 2026 23:57
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>
@jacobaraujo7 jacobaraujo7 merged commit d1eef13 into master Jun 23, 2026
1 of 3 checks passed
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