-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-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.linter-lint-proposaltype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
Description
When doing an operation like
var a = 'foo';
final b = <String, dynamic>{'bar' : 'foo-bar'};
a = b['bar'];This operation should raise a null warning or error. Sometimes, when this map can be outside the function, the programmer can know received types, but as a dynamic type the linter should show a warning or error about null when using null-safety.
Examples
class A {
final String field;
A.fromJson(Map<String, dynamic> json): field = json['foo-bar'];
}In above example, you can't know if field decoded in json is null or not.
Maybe can be a new rule that can be added in analysis_options.yaml
srawlins
Metadata
Metadata
Assignees
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-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.linter-lint-proposaltype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug