Adjust documentation of prefer_void_to_null #58908
Labels
analyzer-linter
Issues with the analyzer's support for the linter package
area-analyzer
Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
linter-set-recommended
P2
A bug or feature request we're likely to work on
type-documentation
A request to add or improve documentation
The lint prefer_void_to_null has a very concise motivation section. #58906 raised the issue that it isn't helpful to recommend that a local variable of type
Null
is changed such that the type isvoid
. An extended motivation section could clarify more broadly in which situations the lint is useful.Another part of the documentation that needs an update is at the end:
Today, with null safety, such collection literals should have the actual type argument
Never
(likeconst <Never>[]
). The type argument could also beNull
, but the collection would then only be usable when the required type has a nullable type argument.Note that a type variable is never a nullable type, which means that
<Null>[]
could never be passed when the required type isList<X>
whereX
is a type variable; this seems to make<Null>[]
nearly useless as a "universal empty list", so we probably don't even want to mention<Null>[]
in the documentation for this lint.The text was updated successfully, but these errors were encountered: