我正在使用mobx
flutter进行状态管理。但是在项目中添加CCD_ 2之后,我无法构建生成的文件。并获得错误
Bad state: Unexpected diagnostics:
C:flutterbincachedart-sdklibcoreuri.dart:3259:39 - Expected an identifier.
[SEVERE] mobx_codegen:mobx_generator on lib/main.dart:
mobx文件:-
import 'package:mobx/mobx.dart';
part 'weather_store.g.dart';
class WeatherStore = _WeatherStore with _$WeatherStore;
abstract class _WeatherStore with Store {
}
pubspec.yaml:-
dependencies:
flutter:
sdk: flutter
mobx: ^0.3.10
flutter_mobx: ^0.3.4+1
provider: ^3.2.0
dev_dependencies:
flutter_test:
sdk: flutter
build_runner:
mobx_codegen: ^0.3.10+1
如何解决这个问题?
编辑:-构建flutter packages pub run build_runner watch
的命令
对于那些已经升级到flutter版本1.20.1
或更高版本的用户,请确保在pubspec.yaml
中添加此行。
dependency_overrides:
analyzer: '0.39.14'