-
Notifications
You must be signed in to change notification settings - Fork 223
Description
Current status: being addressed via #41
The author of a Dart class can add more features to the class, but down-stream clients cannot easily do so.
To work with an existing class, you can write a static helper function, but it's much less convenient to call that as a function than as a method on the object. Example: helper(foo.something).somethingElse
is harder to read and understand the sequencing of than foo.something.helper().somethingElse
.
The best current option is to wrap the existing class in a new class which forwards members to the wrapped object, and then adds some more operations on top. It adds overhead and requires an explicit wrapping operation.
Other languages solve this problem in various ways, including extension methods and pipe operators.
Dart should do something to make it easier for users to add easily usable functionality to existing classes.