Skip to content

request: prefer_typed_future #58402

@negitorogithub

Description

@negitorogithub

Describe the rule you'd like to see implemented
prefer_typed_future is a rule which warns Future without generics.

Examples
This warn
Future result or
Future task(){}.

Future<dynamic> or
Future<void>,
Future<Object?> are allowed.

The motivation is that people should explicit Future<dynamic> when they need.
When you forget to type Future's generics, it will become implicitly Future<dynamic>, which leads to runtime error.(so, this is similar to "implicitly any" in TypeScript)
Therefore, I want this feature to be added.

Additional context
I searched for "future" in Issues, but I wasn't able to find a similar request. Sorry if this feature is duplicated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    devexp-linterIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.type-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions