shutter
1.4.1, released 11 days ago by koji-1009.com
Renders Flutter widget previews to PNG and diffs two runs pixel by pixel.
What it does
Shutter renders Flutter widget previews to PNG during flutter test without launching the app, pairing runs to diff pixel changes before and after edits. It also supports rendering semantics trees and evaluating widget expressions via CLI commands.
AI-written summary of version 1.4.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to review visual changes via before-and-after PNG images during pull requests.
- You want to verify a refactor changed no UI pixels across test runs.
- You need to inspect semantics trees or check widget rendering for overflows without launching the app.
Skip it when
- You need standard widget or unit testing assertions inside Dart test files.
- Your project cannot use flutter_test in dev_dependencies.
Strengths
- Generates clear before, after, and diff images highlighting changed pixels.
- Reuses existing @Preview functions from the project.
- Operates entirely within flutter_test without needing a running app or device.
Weaknesses
- Requires Flutter 3.47+ and flutter_test.
- Comparisons rely on manually managed runs rather than persistent git/golden baselines.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 7
The target project needs Flutter 3.47+ (Dart 3.13+) and flutter_test in dev_dependencies. Run `dart install shutter` and `shutter init` to write the project shell.
import 'package:flutter/material.dart';
import 'package:flutter/widget_previews.dart';
import '../widgets/notification_tile.dart';
@Preview(name: 'NotificationTile', size: Size(360, double.infinity))
Widget notificationTile() => const Material(
child: NotificationTile(
icon: Icons.local_shipping_outlined,
title: 'Your order has shipped',
body: 'It arrives tomorrow.',
timestamp: '5m',
unread: true,
),
);Alternatives
Packages that do the same job and could replace shutter.
- lint_staged
Run linters and custom commands on git staged files for Flutter and Dart projects
44Compare - test_coverage_badge
A CLI tool to generate and display test coverage badges for Dart projects.
41Compare
Works with
Packages commonly used together with shutter: ones it builds on, ones built on it, and its own family.
- analyzershutter depends on itPerforms static analysis of Dart code for tool integration and embedding.
- yamlshutter depends on itA Dart library for parsing YAML documents into Dart data structures.
- cryptoshutter depends on itProvides SHA, MD5, and HMAC hashing functions for Dart.
- argsshutter depends on itLibrary for parsing raw command-line arguments into options and values using GNU and POSIX styles.
- imageshutter depends on itPure Dart library to load, manipulate, encode, and decode various image formats.