Skip to content

build_runner fails with "dart compile does not support build hooks" when cached_network_image is added #1031

Description

@DhirajNavik

Environment

Flutter: 3.38.7 (stable)

Framework • revision 3b62efc2a3

Engine • revision 78fc3012e4

Dart: 3.10.7

DevTools: 2.51.1

Description

A fresh Flutter project reproduces an issue where build_runner fails as soon as cached_network_image is added.

Steps to Reproduce

Create a new Flutter project

flutter create test_project

Add dependencies:

dependencies:
flutter:
sdk: flutter
cached_network_image: ^3.4.1

dev_dependencies:
build_runner: ^2.15.0

Run:

dart run build_runner build

Expected Result

build_runner completes successfully.

Actual Result

build_runner fails with:

Building package executable... (1.2s)
Built build_runner:build_runner.
0s compiling builders/aot

build_runner
E 'dart compile' does not support build hooks, use 'dart build' instead.
E Failed to compile build script. Check builder definitions and generated script
.dart_tool/build/entrypoint/build.dart.

Additional Information

Without cached_network_image:

dart run build_runner build

works successfully.

After adding cached_network_image:

flutter pub deps | findstr hooks

shows:

hooks 2.0.0

and build_runner starts failing.

The issue is reproducible in a fresh Flutter project and does not require Freezed, json_serializable, or any custom code.

Image

deps.txt

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions