Skip to content
pubscout

build_verify

3.1.1, released a year ago by kevmoo.com

Utility to verify generated Dart code is up-to-date during build

$ flutter pub add build_verify
Source repository

What it does

It runs build_runner and checks for uncommitted changes in generated files. If any differences are found, the test fails.

AI-written summary of version 3.1.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You use build_runner to generate code and want to ensure it stays in sync
  • You want to add a CI check that fails when generated code is stale
  • You need a quick way to assert clean builds in unit tests

Skip it when

  • You are not using build_runner or code generation
  • Your project is not under Git version control
  • You need a more sophisticated diff or linting tool

Strengths

  • Simple API, just a single test function
  • Async and works with flutter test
  • Prints executed commands for debugging
  • Supports custom git diff arguments

Weaknesses

  • Requires Git repository to run
  • Depends on build_runner being configured
  • Requires Dart >=3.4.0 for latest version

Setup

Kind
Pure Dart
Effort
Low
Code generation
Yes (build_runner)
Direct dependencies
3

Add a test file with `test('ensure_build', expectBuildClean);` and ensure build_runner is set up in pubspec

import 'package:build_verify/build_verify.dart';
import 'package:test/test.dart';

void main() {
  test('ensure_build', expectBuildClean);
}

Alternatives

Packages that do the same job and could replace build_verify.

Works with

Packages commonly used together with build_verify: ones it builds on, ones built on it, and its own family.