Add an annotation that to indicate to missing_return that implicitly return null is ok #57782
Labels
devexp-linter
Issues with the analyzer's support for the linter package
legacy-area-analyzer
Use area-devexp instead.
It's common to define callbacks where returning
null
is a good default. For example, Flutter'sonGenerateRoute
is to return a route if it can handle the arguments, and return null otherwise, in which case other sources are consulted.Right now,
missing_return
requires that we returnnull
from all such callbacks explicitly.It would be nice if we could annotate the
typedef
for these callbacks to say that rather than requiring a return, it's ok to be missing a return, and indeed, if thereturn null
is the last statement in the method, it's better to just omit it. Maybe this would be a new lint that overridesmissing_return
for these annotated callbacks.The text was updated successfully, but these errors were encountered: