-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
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 is void. 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:
empty literals which are safe to pass into read-only locations for any type of map or list
Today, with null safety, such collection literals should have the actual type argument Never (like const <Never>[]). The type argument could also be Null, 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 is List<X> where X 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.