Refactor for turning typedef
into extension type
#59897
Labels
analyzer-refactoring
analyzer-server
area-analyzer
Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
P3
A lower priority bug or feature request
In my company and personal projects I've seen
typedef
s for things likeList<SomeType>
and other types with generics. Some of the time they come with extensions for helper methods.I'd like to request a refactor that would convert a
typedef
into anextension type
so that in cases like this we can move theextension
declarations over to the newextension type
to increase code clarity and enhance type safety by consolidating related functionality into a unified structure.For most types we could add
implements Type
but we'd need to be careful withRecord
s andFunction
s since that is not possible -Never
too even though I doubt someone has ever usedtypedef
with it (dart-lang/language#3839).Asking for a refactor and not an assist since we'd probably need to add constructors around existing implicit assignments. E.g:
Would become:
Not sure about the placement here but that would be a discussion here.
Somewhat related:
unnecessary_cast
quick-fix unexpected result in switch expression #56072The text was updated successfully, but these errors were encountered: