-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work onarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelinter-false-positiveIssues related to lint rules that report a problem when it isn't a problem.Issues related to lint rules that report a problem when it isn't a problem.linter-set-fluttertype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
Description
Describe the issue
Currently, converting a private widget that has no key
parameter to a @visibleForTesting
widget with no key
parameter will trigger use_key_in_widget_constructors
.
There's no reason for use_key_in_widget_constructors
to be emitted in this case, as the widget is not supposed to be used outside of the library it has been defined anyway.
To Reproduce
With use_key_in_widget_constructors
enabled, the following code emits a warning:
@visibleForTesting
final class PrivateWidget extends StatelessWidget {
const PrivateWidget();
Widget build(BuildContext context) => const SizedBox.shrink();
}
Expected behavior
As the widget is virtually private and is not supposed to be used outside the defining library, the lint should not be emitted.
Metadata
Metadata
Assignees
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work onarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelinter-false-positiveIssues related to lint rules that report a problem when it isn't a problem.Issues related to lint rules that report a problem when it isn't a problem.linter-set-fluttertype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug