3

尝试使用内置值生成器时出错

这是我得到的错误。

[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.

我正在使用的类在其上运行内置值生成器

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;
}
4

2 回答 2

5

正如@Mohammad 在评论中提到的那样,从这个问题中,只需将其添加到pubspec.yaml

dependency_overrides:
  analyzer: '0.39.14'

请注意,这是dependencies和的同级dev_dependencies

于 2020-09-16T14:52:53.900 回答
2

看起来 build_runner 版本 1.10.1 将分析器的版本固定到 0.39.14。

尝试更新 build_runner:build_runner: ^1.10.1而不添加 dependency_overrides: 并查看。

于 2020-09-02T13:45:27.587 回答