3

I got an error while trying to use built value generator

This was the error that i got.

[INFO] Running build...
[INFO] Generating SDK summary.
[SEVERE] built value generator:built value on lib/json_parsing.dart:
Bad state: Unexpected diagnostics:
C:\src\flutter\bin\cacheldart-sdk\lib\core\uri.dart:3259:39 - Expected an identifier.
[SEVERE] built_value_generator:built_value on lib/json_parsing.dart:

Bad state: Unexpected diagnostics:
C:\src\Flutter\bin\cache\dart-sdk\lib\core uri.dart:3259:39 - Expected an identifier.

[SEVERE] built_value_generator:built_value on lib/json_parsing.dart:

Bad state: Unexpected diagnostics:
C:\src\flutter\bin\cache\dart-sdk\lib\coreluri.dart:3259:39 - Expected an identifier.

the class which i was using running the built value generator on

import 'package:built_value/built_value.dart';

part 'src/json_parsing.g.dart';

abstract class Article implements Built<Article, ArticleBuilder> {
  Article._();
  factory Article([void Function(ArticleBuilder) updates]) = _$Article;
}
Mr.Despicable
  • 373
  • 1
  • 4
  • 14

2 Answers2

5

As mentioned by @Mohammad on the comments, and from this issue, just add this to pubspec.yaml:

dependency_overrides:
  analyzer: '0.39.14'

Note, this is a sibling of dependencies and dev_dependencies.

Felipe Augusto
  • 7,733
  • 10
  • 39
  • 73
2

It looks like build_runner version 1.10.1 pinned the version of analyzer to 0.39.14.

Try to update build_runner: build_runner: ^1.10.1 without adding dependency_overrides: and see.

Tevfik Xung
  • 968
  • 3
  • 10
  • 18