-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Labels
breakingbugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
When defining mapping with reverse flag, it is not clear how "constructor" parameter is used. Consider following classes
class Source {
final int a;
final int b;
Source(this.a, this.b);
}
class Target {
final int a;
final int b;
Target(this.a, this.b);
Target.extra(int a) => Source(a, a *2);
}
// Mapping
MapType<Source, Target>(
constructor: 'extra',
reverse: true
)This mapping will generate warning
Couldn't find constructor 'extra', fall-backing to using the most fitted one instead. (Target → Source)
Which is understandable but at first might seem confusing.
Describe the solution you'd like
We can introduce reverseConstructor param which will be used in reverse mode.
- No
constructorand noreverseContructor= standard constructor selection strategy - Only
constructor= use in both way - Only
reverseContructor= Source -> Target uses selection strategy, Target - Source specific contructor constructorandreverseContructor= each way has defined preferred constructor
tenhobi
Metadata
Metadata
Assignees
Labels
breakingbugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request