Skip to content

Move test, codegen, and Widgetbook packages out of root runtime dependencies #536

Description

@jjoonleo

Problem

The root app pubspec.yaml currently declares non-runtime tooling packages in dependencies, so they are treated as part of the app dependency surface. mockito is test-only, freezed is a code generator, and widgetbook / widgetbook_annotation are only used by the separate Widgetbook workspace.

Evidence

  • Root pubspec.yaml lists mockito under dependencies.
  • Root pubspec.yaml lists freezed under dependencies, while app source imports freezed_annotation, not freezed.
  • Root pubspec.yaml lists widgetbook and widgetbook_annotation under dependencies.
  • mockito imports are only under test/.
  • Widgetbook imports are under widgetbook/lib/, and widgetbook/pubspec.yaml already declares its own widgetbook, widgetbook_annotation, widgetbook_generator, and build_runner dependencies.
  • Root code imports freezed_annotation from lib/, so freezed_annotation should remain available to the app unless a separate migration proves otherwise.

Proposed direction

Move mockito and freezed from root dependencies to root dev_dependencies. Remove widgetbook and widgetbook_annotation from the root app pubspec.yaml unless a root app import is added later. Keep Widgetbook-specific packages in widgetbook/pubspec.yaml.

Acceptance criteria

  • Root pubspec.yaml no longer includes mockito, freezed, widgetbook, or widgetbook_annotation in dependencies.
  • Root pubspec.yaml keeps freezed_annotation available for app source imports.
  • Root dev_dependencies includes any root-level test/codegen packages still needed by flutter test or build_runner.
  • flutter pub get, dart run build_runner build --delete-conflicting-outputs, flutter analyze, and flutter test pass for the root app.
  • cd widgetbook && flutter pub get succeeds, and Widgetbook still owns its Widgetbook-specific dependencies.

Source: Codex codebase audit on 2026-06-28.

Metadata

Metadata

Assignees

No one assigned

    Labels

    codex-readyCan be started independently by a Codex thread nowproduction-readinessWork required before production releaserelease-p2Operational follow-up for app releasesetupenvironment setup or library integration

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions