I want to merge two Maps. I can use Map.addAll method, but this method does not support deep merge. I want to use addAll for all Maps and equvivalent method for Lists inside. Recursive solution is not simple task for me and using JS iterop is dirty. Any solution?
Asked
Active
Viewed 280 times
6
-
possible duplicate of [How can I clone an Object (deep copy) in Dart?](http://stackoverflow.com/questions/13107906/how-can-i-clone-an-object-deep-copy-in-dart) – megawac Feb 03 '14 at 00:18
-
Why not copy $.extend from the source? – Johan Feb 03 '14 at 00:22
-
@megawac not a duplicate, that question is asking for a language built in way and the answer is simply 'no'. – Benjamin Gruenbaum Feb 03 '14 at 00:57
-
And it is for merging maps which is different form deep copying of objects. – Günter Zöchbauer Feb 03 '14 at 09:20
1 Answers
3
I have ported it for the Angular Dart UI project, but it's not yet properly tested (but in used in the Rating component)
https://github.com/akserg/angular.dart.ui/blob/master/lib/helper/extend.dart
will be moved shortly to
https://github.com/akserg/angular.dart.ui/blob/master/lib/utils/extend.dart

Günter Zöchbauer
- 623,577
- 216
- 2,003
- 1,567
-
Thx, good work. I've started to work on my own solution with strong typing and not breaking pointers to target, if possible. This work is a great inspiration. – Zdeněk Mlčoch Feb 03 '14 at 13:28