Index: lib/src/utils.dart |
diff --git a/lib/src/utils.dart b/lib/src/utils.dart |
index 59edb66579950c17230e135aee3e08a945c8ead9..3b8111d0f379e9a1171f397c54c42e0984c937e8 100644 |
--- a/lib/src/utils.dart |
+++ b/lib/src/utils.dart |
@@ -98,6 +98,20 @@ List flatten(Iterable nested) { |
return result; |
} |
+/// Returns a new map with all values in both [map1] and [map2]. |
+/// |
+/// If there are conflicting keys, [map2]'s value wins. |
+Map mergeMaps(Map map1, Map map2) { |
+ var result = {}; |
+ map1.forEach((key, value) { |
+ result[key] = value; |
+ }); |
+ map2.forEach((key, value) { |
+ result[key] = value; |
+ }); |
+ return result; |
+} |
+ |
/// Returns a sink that maps events sent to [original] using [fn]. |
StreamSink mapSink(StreamSink original, fn(event)) { |
var controller = new StreamController(sync: true); |