Skip to content

Add an annotation that to indicate to missing_return that implicitly return null is ok #57782

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

Closed
Hixie opened this issue Aug 20, 2018 · 2 comments
Labels
devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead.

Comments

@Hixie
Copy link
Contributor

Hixie commented Aug 20, 2018

It's common to define callbacks where returning null is a good default. For example, Flutter's onGenerateRoute 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 return null 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 the return null is the last statement in the method, it's better to just omit it. Maybe this would be a new lint that overrides missing_return for these annotated callbacks.

@srawlins
Copy link
Member

@pq can you move this to the SDK repo? missing_return is an analyzer hint.

@pq
Copy link
Member

pq commented Dec 29, 2018

This issue was moved to #35520

@pq pq closed this as completed Dec 29, 2018
@devoncarew devoncarew added devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. labels Nov 18, 2024
@devoncarew devoncarew transferred this issue from dart-archive/linter Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead.
Projects
None yet
Development

No branches or pull requests

4 participants