Skip to content

[Proposal] Lint for 'safer' code #58609

@bernaferrari

Description

@bernaferrari

I wish there was a lint for things frequently used that can blow up.
Example:

[].firstWhere(...) // This can throw an exception when false. Use firstWhereOrNull.
[].reduce(...) // This can throw an exception when list is empty, use fold instead.
http.get // This can throw an exception, try adding try/catch to make it safe.

These are often overlooked by people, and they only find out it blows in testing. If we had a lint, it would be easier for those that don't want them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    devexp-linterIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions