greenroom 0.3.1 copy "greenroom: ^0.3.1" to clipboard
greenroom: ^0.3.1 copied to clipboard

Turns Flutter's own @Preview annotations into widget tests proving every preview mounts — with screenshots and a machine-readable verdicts file.

0.3.1 #

  • NEW: skills/flutter-widget-previews/SKILL.md ships with the package — an agent-facing guide to writing @Preview annotations, verifying them, wiring CI, supplying ambient dependencies, and reading failures.
  • FIXED: previews returning WidgetBuilder (legal per Flutter's annotation) generated uncompilable code; they now mount through a Builder.
  • FIXED (fail-open bug): when the target project did not resolve — no pub get, broken package_config, SDK mismatch — discovery silently found zero previews and the generated suite PASSED while proving nothing. greenroom now refuses to generate unless package:flutter/widgets.dart resolves, and reports a missing flutter_test dev_dependency.
  • The missing-entry message no longer claims "has required parameters" for widgets whose only barrier is having no unnamed constructor.

0.3.0 #

  • ALL @Preview fields are now applied — theme: and localizations: included. Every annotation (direct or subclass) is re-instantiated by the generated test with resolved imports and applied at runtime, deleting the static field-extraction path. PreviewThemeData's API drift across the supported range (newer apply() vs older theme fields) is bridged dynamically so one generated file works everywhere.
  • Verified end-to-end on Flutter 3.38.5 and 3.47.0, including cross-library wrapper + theme arguments, a German localizations: preview, and MultiPreview runtime expansion.

Unreleased #

  • REMOVED: the classified fix-hint table. A failure is Flutter's native error report, nothing else.

0.2.0 #

  • Discovery is now fully RESOLVED (analyzer resolution; target must be pub get-able): element-identity provenance, constant-evaluated annotation fields, wrapper: from any library, Preview/MultiPreview subclass expansion at runtime (the official previewer's architecture), transitive widget-base detection, InheritedWidgets excluded as subjects.

  • Version support widened and verified end-to-end: Dart ^3.9.0 (Flutter 3.35+, where @Preview shipped); analyzer >=12.1.0 <15.0.0 tested at 12.1 / 13.3 / 14.0 / 14.1; runs proven on Flutter 3.38.5 and 3.47.0.

  • REMOVED: greenroom watch (the resident daemon) and the analyzer plugin — agents run flutter test; ambient verdicts served a keystroke cadence that agent-driven authorship doesn't have. Git history keeps them.

  • Failures now carry Flutter's FULL native error report (zero summarization) plus at most one greenroom: hint, kept only where it encodes convention knowledge Flutter cannot have (missing fakes, shell, test-vs-previewer policy). Layout advice is Flutter's own.

0.1.0 #

Initial release.

  • dart run greenroom: generates a self-contained test/greenroom.g_test.dart from Flutter's own @Preview annotations — one testWidgets per annotation (stacked annotations included), honoring name / size / textScaleFactor / brightness / wrapper with the official previewer's exact semantics.
  • Bare mounts for default-constructible widgets; failing obligation tests for widgets that can be neither entered nor bare-mounted.
  • PNG screenshot per passing test (real Roboto/MaterialIcons glyphs) and a hash-stamped .dart_tool/greenroom/verdicts.json, written by the test run itself — flutter test is the runner and the gate.
  • Failure output built for agents: exception, file:line:col attribution (project stack frame, or widget creation location for layout errors), and a classified fix hint.
  • --check: CI drift guard (exit 1 when the committed generated file is stale). greenroom watch: optional resident dev mode (~200ms edit→verdict).
  • Import-gated annotation provenance; lib/preview/shell.dart hook for mounting under the app's real wrappers with fake services.
1
likes
150
points
218
downloads

Documentation

API reference

Publisher

verified publisherwenkaifan.com

Weekly Downloads

Turns Flutter's own @Preview annotations into widget tests proving every preview mounts — with screenshots and a machine-readable verdicts file.

License

MIT (license)

Dependencies

analyzer, crypto, dart_style, path

More

Packages that depend on greenroom