我正在学习 Flutter,并创建了一个简单的 Android 应用程序。我想遵循最佳实践,所以我还创建了一个analysis_options.yaml
:
include: package:pedantic/analysis_options.yaml
linter:
rules:
public_member_api_docs: true
Android Studio 根据analysis_options.yaml
并报告违规行为正确更新其代码分析设置。
问题是,当我运行flutter analyze
它时,它不会报告任何public_member_api_docs
:
flutter analyze
Running "flutter pub get" in flutter-course... 514ms
Analyzing flutter-course...
info • Unused import: 'package:places/ui/screen/sight_list_screen.dart' • lib/main.dart:2:8 • unused_import
info • Omit type annotations for local variables • lib/ui/screen/visiting_screen.dart:166:5 • omit_local_variable_types
但是当我运行dart analyze
它时会报告大量警告:
dart analyze
Analyzing flutter-course... 2.1s
info • Document all public members at lib/constants.dart:5:16 • (public_member_api_docs)
info • Document all public members at lib/constants.dart:6:16 • (public_member_api_docs)
…
info • Unused import: 'package:places/ui/screen/sight_list_screen.dart' • lib/main.dart:2:8 • unused_import
info • Omit type annotations for local variables • lib/ui/screen/visiting_screen.dart:166:5 • omit_local_variable_types
为什么不flutter analyze
尊重我的设置analysis_options.yaml
?