Open
Description
How about a lint that fires when you write dynamic
for a parameter type but Object
would have worked?
e.g.
void foo(dynamic bar) {
if (bar is String) {
...
} else if (bar is int) {
...
} else throw UnsupportedError();
}
I see this pretty frequently and I think it hides a misunderstanding about what dynamic
is useful for, i.e. for the rare cases when you want to turn off static checking and always do dynamic dispatch.
Happy to take a shot at implementing this if you think it makes sense, particularly if you can give hints about how to figure out whether dynamic dispatch was used :)
Thanks!
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
bwilkerson commentedon Dec 11, 2019
@leafpetersen @srawlins
I know that we were, at one point, looking to define a coherent set of options related to uses of
dynamic
, but I don't know whether this would have been covered or what the current status of that work is. Is that still planned?Should something like this be implemented as a lint, or would it be covered by the mechanisms above?