[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collection_methods_unrelated_type does not warn about null keys. #5004

Open
fuzzybinary opened this issue Jun 28, 2024 · 1 comment
Open
Labels
set-core Affects a rule in the core Dart rule set

Comments

@fuzzybinary
Copy link

Describe the issue
According to #3049, collection_methods_unrelated_type should warn about using null as a key to a non-nullable collection. However, the following code does not generate the lint:

final v = <String, String>{ “somekey” : “somevalue” };
final nv = v[null];

If this is expected, I propose another lint that will warn about indexing into collections with non-null keys with potentially null values.

To Reproduce

The following code:

final v = <String, String>{ “somekey” : “somevalue” };
final nv = v[null];

Expected behavior
Warn on line 2 about null being used to on a map with non-null keys.

@github-actions github-actions bot added the set-core Affects a rule in the core Dart rule set label Jun 28, 2024
@srawlins
Copy link
Member

That seems fair.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
set-core Affects a rule in the core Dart rule set
Projects
None yet
Development

No branches or pull requests

2 participants