禁止使用受保护成员的提示 [英] Suppress hint about use of protected member
问题描述
meta 套件提供 @protected $ c $
The meta package provides a @protected
annotation (besides others) to get analyzer hints or warnings about the use of protected members outside of direct subclasses.
INFO:成员可以使用注释(除了其他外)来获取分析器提示或警告。 'selectedChildrenChanged'只能在MenuItem的子类的实例成员中使用([bwu_ng_quick_nav] test / menu_item_test.dart:108)
INFO: The member 'selectedChildrenChanged' can only be used within instance members of subclasses of 'MenuItem' ([bwu_ng_quick_nav] test/menu_item_test.dart:108)
如何禁止这些提示?
推荐答案
@protected
提示的抑制代码为 INVALID_USE_OF_PROTECTED_MEMBER
。添加抑制评论,如:
The suppression code for the @protected
hint is INVALID_USE_OF_PROTECTED_MEMBER
. Add a suppression comment like:
// ignore: INVALID_USE_OF_PROTECTED_MEMBER
app.quickNav.keyDownHandler(ctrlKeyDown);
其他提示的代码可在
- https://github.com/dart-lang/sdk/blob/master/pkg/analyzer/lib/src/error/codes.dart
- https:// github.com/dart-lang/sdk/blob/master/pkg/analyzer/lib/src/dart/error/hint_codes.dart
- https://github.com/dart- lang / sdk / blob / master / pkg / analyzer / lib / src / dart / error / lint_codes.dart
- https://github.com/dart-lang/sdk/blob/master/pkg/analyzer/lib/src/error/codes.dart
- https://github.com/dart-lang/sdk/blob/master/pkg/analyzer/lib/src/dart/error/hint_codes.dart
- https://github.com/dart-lang/sdk/blob/master/pkg/analyzer/lib/src/dart/error/lint_codes.dart
这适用于 Dart VM版本:1.16.0-edge
。我不知道这个发布的版本。
This works with Dart VM version: 1.16.0-edge
. I don't know with what version this was released.
希望这些ID将成为警告的一部分,很快就不必查找。
Hopefully these IDs will be part of the warnings soon to not have to look them up.
这篇关于禁止使用受保护成员的提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!