Skip to content

Invalid build.yaml in version 0.8.0 causes parse error during build_runner execution #113

@Nizlan

Description

@Nizlan

Hi @ethanblake4,

I'm encountering a parse error when running build_runner in a Flutter project that depends on flutter_eval: ^0.8.0. This seems to stem from an invalid configuration in the package's build.yaml file, which appears to be an incomplete example snippet.

Steps to Reproduce:

  • Add flutter_eval: ^0.8.0 to your pubspec.yaml under dependencies.
  • Ensure you have build_runner installed.
  • Run dart pub get to fetch dependencies.
  • Run dart pub run build_runner build.

Error Log:

Building package executable... (2.0s)
Built build_runner:build_runner.

log output for build_runner
E Failed to parse build.yaml for flutter_eval: Invalid argument(s): line 6, column 7 of ../.pub-cache/hosted/pub.dev/flutter_eval-0.8.0/build.yaml:
Unsupported value for "builders". type 'Null' is not a subtype of type 'Map<dynamic, dynamic>' in type cast
╷
6 │       dart_eval_generator|member_count:
│       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Problematic Code in build.yaml (from pub cache):

The file at ~/.pub-cache/hosted/pub.dev/flutter_eval-0.8.0/build.yaml contains:

texttargets:
  $default:
    builders:
      # Configure the builder pkg_name|builder_name
      # In this case, the member_count builder defined in ../example
      dart_eval_generator|member_count:

The last line is incomplete—it lacks a map value (e.g., enabled: true), causing the parse failure as it's treated as null.
This error only occurs if build_runner is used in the project (e.g., for other code generation tasks like json_serializable or freezed). If not using build_runner, everything works fine, which might explain why it hasn't been reported yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions