InconsistentAnalysisException: always with an annotated enum value + source_gen + json_serializable

enum StatusCode {
  @JsonValue(200)
  success,
}

It only happens in build for json_serializable.

It starts with an annotation that has a null element.

  • Sync https://github.com/google/json_serializable.dart/
  • cd json_serializable
  • pub upgrade
  • pub run build_runner watch --verbose --delete-conflicting-outputs
  • If you don’t get the error right away, go edit a file – like ‘example/example.dart` – just enough to make build kick off

If you want a process to attach to – once the first build is ran

dart .dart_tool/build/entrypoint/build.dart watch --verbose --delete-conflicting-outputs

1 possible answer(s) on “InconsistentAnalysisException: always with an annotated enum value + source_gen + json_serializable