-
Notifications
You must be signed in to change notification settings - Fork 205
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
Add extensions on non-function typedefs #2284
Comments
The non-function type alias feature does work with extensions: class Car {}
typedef Cars = List<Car>;
extension on Cars {
void foo() {
print('This is foo!');
}
}
void main() {
<Car>[].foo(); // Compiles, runs, and prints.
} However, it looks like your example is intended to make If you wish to be able to declare static methods in an extension and call them as if they had been static methods on something (for instance, if the extension is |
You're right. I first did a |
In the original issue for introducing typedefs for non-function types, I saw questions about how extensions would work with this new feature. However, it seems that this did not make the cut yet.
The purpose of this could be something like this to parse more conveniently json lists of objects:
Original comment:
That's how it works already with extensions on functions, so likely.
Originally posted by @rrousselGit in #65 (comment)
The text was updated successfully, but these errors were encountered: