Skip to content
CAI
Software that uses CAICheck a score

mobxjs/mobx.dart

63.5

Adequate · 13 November 2026

11.9k

lines of production code

Dart

with TypeScript

8

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a reactive state management library for Dart and Flutter, built on a monorepo structure that includes core logic, code generation tools, and linting utilities. It enables developers to manage application state through observables, computed values, and actions, while automatically generating boilerplate code to integrate with the Flutter widget tree. The system supports complex scenarios including asynchronous data handling, collection mutations, and manual atom-based reactivity, all backed by comprehensive testing and performance benchmarking.

How it got here

2018–2019 — Monorepo restructuring and API modernization

36 changes.

The project was reorganized into a Melos monorepo, modernizing the core MobX library with stricter reactive contexts, configurable policies, and expanded observable collection support. Concurrently, the code generator was rewritten to use the Element2 API, and the flutter\_mobx package was refactored to expose a cleaner public API with improved debugging and widget composition. This period also saw the addition of comprehensive test suites and a wide array of example applications to demonstrate the new features.

2020–2026 — Documentation, benchmarking, and tooling expansion

10 changes.

This period focused on expanding the project's ecosystem with new reactive state management examples, a performance benchmarking suite, and a 'Wrap with Observer' linting code assist. Significant infrastructure work included deploying the documentation gallery to Cloudflare Pages, implementing Material 3 theming with deferred loading, and adding comprehensive test coverage for benchmarks and UI interactions. The work also addressed legacy site redirection to ensure users are directed to the new project domain.

Features

Add 'Wrap with Observer' code assist

The linter now provides a new code assist that automatically wraps selected widget constructors in an Observer widget. This feature helps users quickly integrate reactivity into their Flutter UI components by inserting the necessary Observer boilerplate around the selected code.

_mobx\lint/lib · high confidence

Add Hacker News example app demonstrating reactive state management

A new Hacker News example has been added to the examples directory, providing a complete Flutter application that fetches and displays news stories from the Hacker News API. The implementation uses MobX to manage reactive state, featuring a store that handles asynchronous data fetching for both 'Newest' and 'Top' story feeds, and UI widgets that automatically update based on the loading, success, or error status of these observables.

_mobx\examples/lib/hackernews · high confidence

Add random stream example using ObservableStream

The random\_stream example now demonstrates how to use ObservableStream to react to periodic updates. The RandomStore creates a timer that emits random integers every second into a StreamController, which is wrapped in an ObservableStream. The UI uses an Observer widget to display the latest value, automatically updating as new numbers are generated.

_mobx\_examples/lib/random\stream · high confidence

Added Flutter Web entry point for MobX examples

A new index.html file has been added to the web directory, serving as the HTML entry point for running the MobX examples in a browser. This file includes the necessary meta tags and loads the flutter\_bootstrap.js script, enabling the Flutter web application to initialize correctly.

_mobx\examples/web · high confidence

Added MobX counter examples with and without code generation

The \mobx\_examples/lib/counter\ directory now includes example implementations demonstrating how to use MobX in Flutter. This includes a standard store-based counter using code generation (\counter.dart\ and \counter.g.dart\) and a manual observable counter without code generation (\without\_codegen.dart\), along with their corresponding UI widgets (\counter\_widgets.dart\). These examples serve as a reference for integrating MobX state management into Flutter applications.

_mobx\examples/lib/counter · high confidence

Added MobX example application with Counter and Todos stores

The \mobx/example\ directory now includes a complete example application demonstrating core MobX features. It provides a simple Counter store and a more complex Todos store that showcases observables, computed properties, and actions. The entry includes the source files (\counter.dart\, \todos.dart\) and their corresponding generated code (\\*.g.dart\), along with a README explaining how to use annotations and run the code generator.

mobx/example · high confidence

Added MobX raw API example

A new example file demonstrating the use of MobX's raw API has been added to the examples directory. It shows how to create an observable, a computed value, and a parametrized action using the underlying store mechanisms.

_mobx\examples/lib/raw · high confidence

Added connectivity status monitoring example

The connectivity example now demonstrates how to monitor network status changes using MobX. It introduces a ConnectivityStore that wraps the connectivity\_plus stream into an ObservableStream, and a UI widget that uses ReactionBuilder to react to these changes by displaying a snackbar indicating whether the device is online or offline.

_mobx\examples/lib/connectivity · high confidence

Introduction of ObservableList, ObservableMap, and ObservableSet with action-enforced mutations

The \mobx/lib/src/api/observable\_collections\ area now provides reactive wrappers for Dart's standard collections: \ObservableList\, \ObservableMap\, and \ObservableSet\. These classes implement \Listenable\ interfaces that notify listeners of structural changes (add, remove, update, clear). Crucially, all mutating methods (such as \add\, \set\, \remove\, and \clear\) are wrapped in conditional actions via \conditionallyRunInAction\, ensuring that state changes are batched and tracked correctly within the MobX reactive context, while read operations enforce the read policy to track dependencies.

_mobx/lib/src/api/observable\collections · high confidence

Added build and deployment scripts for hosting the Flutter documentation site and gallery on Cloudflare Pages. The new \tool/cloudflare\ directory includes a build script (\build.sh\) that provisions a specific Flutter SDK version (3.47.2) and runs the VitePress documentation build, alongside a provisioning script (\ensure-project.mjs\) that automatically creates or validates the Cloudflare Pages project via API. This enables GitHub Actions to deploy the combined output (including JavaScript and Wasm builds) to Cloudflare without requiring a Cloudflare-hosted build environment or GitHub App installation.

tool/cloudflare · high confidence

New Dice Counter example demonstrating reactive state management

A new interactive example has been added to the \mobx\_examples/lib/dice\ directory, showcasing how to manage reactive state with MobX in a Flutter application. The implementation includes a \DiceCounter\ store that tracks two dice values and a computed total, along with a UI that uses the \Provider\ package to inject the store and \Observer\ widgets to automatically update the displayed dice images and total sum when the user taps to roll.

_mobx\examples/lib/dice · high confidence

New GitHub repository browser example

Added a new Flutter example in the \github\_examples\ module that demonstrates fetching and displaying GitHub user repositories. The implementation includes a \GithubStore\ using MobX observables and actions to manage the API request lifecycle (including loading and error states via \ObservableFuture\), alongside UI widgets that reactively render the repository list, loading indicators, and error messages.

_mobx\examples/lib/github · high confidence

New MobX Todos example using Provider and JSON serialization

The \mobx\_examples/lib/todos\ location now includes a complete, runnable example demonstrating a Todo application. This example introduces a \TodoList\ store that manages observable state (including an \ObservableList\<Todo\>\) and computed properties for filtering and status descriptions. It showcases integration with the \Provider\ package for state management in Flutter widgets, utilizes \json\_annotation\ and generated code (\todo.g.dart\, \todo\_list.g.dart\) for serializing the store to and from JSON, and implements UI components like \ToggleButtons\ for visibility filtering and \Observer\ widgets for reactive UI updates.

_mobx\examples/lib/todos · high confidence

New MobX performance benchmarking suite and documentation

The \mobx/benchmark\ directory now includes a comprehensive performance suite with 35 workloads from \medz/dart-reactivity-benchmark\, a median-based propagation runner, and collection scaling/batching tests. This suite allows users to measure and compare MobX reactivity performance across native and Wasm environments, with detailed documentation on running benchmarks, comparing results, and interpreting performance data. The benchmark includes correctness regression tests and audit specifications to ensure reactive behavior remains correct while measuring performance improvements.

_mobx/benchmark, mobx/tool, mobx\examples/lib/site · high confidence

New async observable wrappers for Futures and Streams

The library now exposes \ObservableFuture\ and \ObservableStream\ classes in the async API, allowing asynchronous operations to be tracked as reactive state. \ObservableFuture\ exposes a \status\ (pending, fulfilled, rejected) and a \result\ property that updates automatically when the underlying future completes, while \ObservableStream\ mirrors emitted values and errors into observable properties like \data\, \value\, and \status\. These classes enable reactions to trigger on async completion or stream events without manual subscription management.

mobx/lib/src/api/async · high confidence

The examples module has been restructured to include a new documentation gallery that lists available MobX examples (Counter, Multi Counter, Todos, etc.) in a navigable list. The app now uses Provider to manage stores (MultiCounterStore, Counter, SettingsStore, ConnectivityStore) and integrates with shared\_preferences for settings. A spy is enabled on the main context for debugging. The app entry point now initializes Flutter bindings and sets up the provider hierarchy before running the app.

_mobx\examples/lib · high confidence

New extension methods for converting standard types to Observable collections and primitives

This change introduces new Dart extension methods in the \mobx/lib/src/api/extensions\ directory, allowing users to easily convert standard Dart types into their observable counterparts. Specifically, \Future\, \List\, \Map\, \Set\, and \Stream\ types now have an \asObservable()\ method to create \ObservableFuture\, \ObservableList\, \ObservableMap\, \ObservableSet\, and \ObservableStream\ instances respectively. Additionally, primitive types (\int\, \bool\, \double\, \String\) gain an \obs()\ method to create simple \Observable\ wrappers, and \Observable\<bool\>\ gains a \toggle()\ method for convenient value flipping.

mobx/lib/src/api/extensions · high confidence

New login form example with reactive validation

Added a new example in the form module demonstrating a login/signup form that uses MobX for reactive state management. The FormStore manages observable fields for username, email, and password, along with an ObservableFuture for asynchronous username availability checks. Reactions automatically trigger validation logic when fields change, updating error states and computed properties like canLogin. The UI widgets use Observer to reactively display validation errors and a progress indicator during pending checks, with proper disposal of reactions in the widget's lifecycle.

_mobx\examples/lib/form · high confidence

New multi-counter example demonstrating dynamic store lists

Added a new example in the multi-counter location that demonstrates managing a dynamic list of observable stores. The MultiCounterStore maintains an ObservableList of SingleCounter instances, allowing users to add or remove individual counters. The UI uses Provider to inject the store and Observer widgets to reactively render the list of counters and their individual values, showing how to handle collections of stateful objects in a Flutter app.

_mobx\_examples/lib/multi\counter · high confidence

New tooling scripts for coverage, API documentation, and version management

The \tool/\ directory now includes several new scripts to support development and publishing workflows. \coverage.sh\ automates running Dart tests and generating LCOV coverage reports for the \lib\ directory. \docs\_inventory.dart\ scans public exports from core packages (mobx, flutter\_mobx, mobx\_codegen, mobx\_lint) to generate or validate a JSON API reference file, ensuring documentation consistency. \expose\_version.dart\ reads the version from \pubspec.yaml\ and generates a \version.dart\ file, while \version\_lint.dart\ acts as a wrapper to run Melos version commands within the mobx\_lint package.

tool · high confidence

Project initialization and repository structure setup

The repository has been initialized with the core project files, including the MIT License, a comprehensive README with documentation and badges, and a CHANGELOG tracking versions for the \mobx\, \flutter\_mobx\, \mobx\_codegen\, and \mobx\_lint\ packages. The project is configured as a monorepo using Melos, with a \.gitignore\ updated to exclude Flutter-specific build artifacts (iOS/Android folders) and IDE files. Additionally, infrastructure files have been added to support CI/CD and community standards, including a \codecov.yml\ for coverage reporting, a \netlify.toml\ for site redirects, a \CODE\_OF\_CONDUCT.md\, and an \.all-contributorsrc\ to automatically manage contributor recognition in the README.

(repo-wide) · high confidence

Behavioural changes

Added clock example using MobX Atom for manual observation

The clock example in mobx\_examples/lib/clock has been updated to demonstrate manual observation using MobX's Atom API. The new clock.dart implementation replaces previous observable patterns with a Clock class that uses an Atom to manually report observation and changes, triggering a periodic timer that updates the time every second. The accompanying clock\_widgets.dart file provides a Flutter UI that wraps the clock in an Observer widget to display the formatted time, showing users how to integrate manual atom-based reactivity with Flutter's widget tree.

_mobx\examples/lib/clock · high confidence

Internal refactoring of core MobX source files

The internal implementation of the MobX library has been reorganized, with core components such as actions, atoms, computed values, contexts, derivations, observables, reactions, and spy utilities consolidated into a new core.dart entry point and its associated part files. This change also introduces updated exception handling classes (MobXException, MobXCyclicReactionException, MobXCaughtException) with improved toString implementations and adds utility functions for equality checking and delayed scheduling, alongside new interceptable and listenable interfaces to manage change notifications and interceptors more effectively.

mobx/lib/src · medium confidence

MobX code generator refactored to use the analyzer Element2 API with improved error reporting

The code generation engine in \mobx\_codegen\ has been rewritten to migrate from the legacy analyzer API to the newer Element2 model (required for analyzer \>= 7.4.0). This change updates the core visitor logic in \store\_class\_visitor.dart\ and the type resolution logic in \type\_names.dart\ to correctly handle import prefixes and nullability suffixes in generated code. Additionally, a new \errors.dart\ module has been introduced to provide structured, user-friendly validation messages for common store configuration mistakes, such as using \@observable\ on methods or \@computed\ on fields.

_mobx\codegen/lib/src · high confidence

MobX library restructured and updated to version 2.7.0

The mobx package has been reorganized with files moved into a dedicated mobx/ directory, and the main entry point (mobx.dart) now explicitly exports the core API components including actions, annotations (such as @readonly and @computed), async observables, and collection types. The library version has been updated to 2.7.0, reflecting recent changes and improvements in the state management system.

mobx/lib · high confidence

The MobX Flutter examples now feature a redesigned documentation gallery that replaces the previous layout. The gallery app uses the \material\_ui\ package and Material 3 for its theme, and implements lazy loading for individual examples (counter, cart, tasks, collections, async, stream, reactions, dependencies) via deferred imports to improve initial load performance. A new \DeferredExample\ widget manages the loading state and allows retrying on failure, while \GoRouter\ handles navigation between the catalog index and the specific example pages.

_mobx\examples/lib/gallery · high confidence

ReactiveContext now enforces configurable read and write policies

The core \ReactiveContext\ now exposes \ReactiveConfig\ with \readPolicy\ and \writePolicy\ settings, allowing you to enforce that observable reads happen only inside reactions/computeds (\ReactiveReadPolicy.always\) and that mutations occur only inside actions (\ReactiveWritePolicy.observed\ or \always\). These policies are applied via \enforceReadPolicy\ and \enforceWritePolicy\ in the new \atom\_extensions.dart\ and \context\_extensions.dart\, and the \ActionController\ and \conditionallyRunInAction\ helpers ensure state changes are properly batched and tracked. This gives you stricter control over state mutation and observation boundaries to catch unintended side effects early.

mobx/lib/src/core · high confidence

Refactored Observer internals and added MultiReactionBuilder

The Observer widget has been refactored to use new base classes (StatelessObserverWidget, StatefulObserverWidget) and a shared mixin (ObserverWidgetMixin) for cleaner architecture. A new MultiReactionBuilder widget is introduced to merge multiple ReactionBuilder widgets into a single tree, reducing nesting boilerplate. Additionally, the Observer now includes the source code location in its debug name by default (controlled by debugAddStackTraceInObserverName) to help identify where warnings or errors originate, and the Observer.withBuiltChild constructor now correctly excludes the child branch from being rebuilt when the builder function errors.

_flutter\mobx/lib/src · high confidence

Replaced legacy code generation templates with a modular, object-oriented template system

The code generator's internal structure has been completely rewritten to use a new set of dedicated template classes (ActionTemplate, AsyncActionTemplate, ComputedTemplate, ObservableTemplate, etc.) instead of the previous string-based or monolithic approach. This change introduces support for advanced observable features such as late initialization, custom equality checks, and deep equality, while also enabling the generation of mixins for stores, async actions, and observable futures/streams. Additionally, the generated output now includes standardized analyzer ignore directives and improved handling of method parameters and type arguments.

_mobx\codegen/lib/src/template · high confidence

Reworked public API surface with new annotations and context support

The \mobx/lib/src/api\ module has been restructured to expose a cleaner, more configurable public API. Users can now define stores using the \Store\ mixin and configure them via the new \@StoreConfig\ annotation. Observable fields are declared with \@observable\ (or \@readonly\), supporting custom equality checks via the \equals\ parameter and deep equality for collections. Computed values use \@computed\ with an optional \keepAlive\ flag, and actions are marked with \@action\. The API now supports custom \ReactiveContext\ instances via \createContext()\, allowing parallel reactivity systems, and reactions (\autorun\, \reaction\, \when\) accept optional \scheduler\ and \onError\ parameters for finer control over execution and error handling.

mobx/lib/src/api · high confidence

Simplified settings initialization and updated MobX API usage

The settings example now requires external dependency injection for SharedPreferences, removing the internal asynchronous loading logic from PreferencesService and SettingsStore. This change simplifies the store's constructor by directly reading the initial dark mode preference instead of awaiting a separate setup phase. Additionally, the generated code has been updated to use the newer MobX API methods (reportRead, reportWrite) and includes a toString implementation for easier debugging.

_mobx\examples/lib/settings · high confidence

Updated example project configuration and added Dice example

The mobx\_examples project has been updated to support Flutter's migrate tool, adding platform-specific metadata for Android, iOS, Linux, macOS, Web, and Windows, and introducing a new .gitignore file to exclude build artifacts and platform folders. The project now includes a new Dice example, documented in the README, and has removed the build.yaml configuration file previously used for json\_serializable. Additionally, the Flutter SDK revision has been updated to a newer stable channel version.

_mobx\examples · high confidence

Version 2.8.0 release with builder options support

This update releases mobx\_codegen version 2.8.0, moving the version constant from the main library file to a dedicated version.dart file for better management. Additionally, the StoreGenerator builder now accepts BuilderOptions, allowing configuration options to be passed through to the code generation process.

_mobx\codegen/lib · high confidence

flutter\_mobx 2.4.0: SDK upgrade and Observer debug improvements

This release upgrades the minimum Dart SDK to 3.7.0 and simplifies the library's constructors. It also improves reactivity performance and correctness, specifically fixing Observer debug caller names for Dart Wasm stack traces (including subclass constructor frames) and verifying widget tests on native Flutter and Chrome Wasm. Additionally, the package now uses standard Flutter lints via a new analysis\_options.yaml file and removes the legacy .iml file.

_flutter\mobx · high confidence

flutter\_mobx v2.4.0 release with expanded public API

The flutter\_mobx package has been updated to version 2.4.0. This release exposes several new components in the public API, including MultiReactionBuilder, ReactionBuilder, StatelessObserverWidget, StatefulObserverWidget, and the ObserverWidgetMixin, in addition to the existing Observer widget. The version constant is now centralized in a generated version.dart file.

_flutter\mobx/lib · high confidence

Fixes

Redirect legacy MobX.dart site to new domain

A new HTML landing page has been added to the tool/netlify-redirect location to handle traffic for the legacy MobX.dart site. Visitors accessing this page are now presented with a message indicating that the project has moved, with a direct link to the new domain at mobx.vyuh.tech.

tool/netlify-redirect · high confidence

Test coverage

Added benchmark harness and regression test suites; Added comprehensive test suite for mobx\_codegen; Added test coverage for Observer, ReactionBuilder, and MultiReactionBuilder widgets; Added tests for observable extension methods; Added tests for the 'Wrap with Observer' code assist; Added tests for the MobX documentation gallery; Added unit tests for TodoList state management and serialization; Comprehensive test suite for MobX core primitives and collections; Expanded test coverage for code generation edge cases and annotations.

Dependencies

Workspace restructure and dependency updates across MobX Dart packages

The repository has been restructured into a Melos monorepo workspace, introducing a root \pubspec.yaml\ that manages \mobx\, \flutter\_mobx\, \mobx\_codegen\, and \mobx\_examples\. This change updates the Dart SDK constraints to \\>=3.7.0\ (or \\>=3.9.0\ for examples) and upgrades core dependencies, including \analyzer\ to \^13.3.0\ in \mobx\_codegen\ and \^8.4.0\ in \mobx\_lint\, \mocktail\ to \^1.0.5\, and \provider\ to \^6.1.5+1\. The documentation site (\docs/\) has been migrated to VitePress with Vue 3, and the \flutter\_mobx\ package now requires \mobx ^2.7.0\.

(dependencies) · high confidence

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 67 → 64 (-3.3)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.3) — scores are not directly comparable.

Lenses

  • Code Health 82 → 82 (+0.0)
  • Architecture 92 → 91 (-0.6)
  • Maturity 74 → 51 (-22.9)
  • Readiness 54 → 63 (+8.5)
  • Security 78 → 82 (+4.1)
  • Performance 85 → 100 (+15.4)

Resolved (7)

  • Duplicated block (10 lines × 2) (mobx_codegen/lib/src/template/observable_future.dart)
  • High secret: WD-SECRET-0005 (docs/package-lock.json)
  • No SBOM
  • No artifact signing
  • No build provenance
  • Rotate the exposed credentials — git history can't be un-committed
  • Unpinned build actions

New (13)

  • Duplicated block (10 lines × 2) (mobx_codegen/lib/src/template/observable_future.dart)
  • Edited copies of one member (3 members, 12+ corresponding lines) (mobx/lib/src/api/observable_collections/observable_list.dart)
  • Edited copy of a member (11 corresponding lines) (mobx/example/lib/todos.dart)
  • Edited copy of a member (11 corresponding lines) (mobx/lib/src/api/observable_collections/observable_list.dart)
  • Edited copy of a member (11 corresponding lines) (mobx_codegen/lib/src/template/action.dart)
  • Edited copy of a member (12 corresponding lines) (mobx/lib/src/api/async/observable_stream.dart)
  • Edited copy of a member (14 corresponding lines) (mobx/lib/src/api/observable_collections/observable_list.dart)
  • Edited copy of a member (14 corresponding lines) (mobx/lib/src/core/context.dart)
  • Edited copy of a member (17 corresponding lines) (mobx/lib/src/api/async/async_action.dart)
  • Edited copy of a member (22 corresponding lines) (mobx/lib/src/api/observable_collections/observable_list.dart)
  • Edited copy of a member (27 corresponding lines) (mobx_examples/lib/counter/counter_widgets.dart)
  • Edited copy of a member (3 corresponding lines) (mobx/lib/src/api/observable_collections/observable_map.dart)
  • Edited copy of a member (3 corresponding lines) (mobx_codegen/lib/src/template/comma_list.dart)

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

mobxjs/mobx.dart was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 13 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 4fe5e0f93ead0d2d0c385ec826d152c5e7165c68 — the exact code this score is about.
  • Scored under rubric-2026.11.3 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.57+preprod-8ebfb01cf4c0.