2021-09-12 00:03:13 +00:00
|
|
|
# Belatuk Merge Map
|
|
|
|
|
2021-09-16 03:23:05 +00:00
|
|
|

|
2021-09-11 14:09:54 +00:00
|
|
|
[](https://dart.dev/null-safety)
|
2021-09-12 03:21:17 +00:00
|
|
|
[](https://github.com/dart-backend/belatuk-common-utilities/blob/main/packages/merge_map/LICENSE)
|
2021-09-11 14:09:54 +00:00
|
|
|
|
2021-09-12 00:03:13 +00:00
|
|
|
**Replacement of `package:merge_map` with breaking changes to support NNBD.**
|
2021-09-11 14:09:54 +00:00
|
|
|
|
|
|
|
Combine multiple Maps into one. Equivalent to
|
|
|
|
[Object.assign](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
|
|
|
|
in JS.
|
|
|
|
|
2021-09-12 00:03:13 +00:00
|
|
|
## Example
|
2021-09-11 14:09:54 +00:00
|
|
|
|
|
|
|
```dart
|
2021-09-12 00:03:13 +00:00
|
|
|
import "package:belatuk_merge_map/belatuk_merge_map.dart";
|
2021-09-11 14:09:54 +00:00
|
|
|
|
|
|
|
void main() {
|
|
|
|
Map map1 = {'hello': 'world'};
|
|
|
|
Map map2 = {'foo': {'bar': 'baz', 'this': 'will be overwritten'}};
|
|
|
|
Map map3 = {'foo': {'john': 'doe', 'this': 'overrides previous maps'}};
|
|
|
|
Map merged = mergeMap(map1, map2, map3);
|
|
|
|
|
|
|
|
// {hello: world, foo: {bar: baz, john: doe, this: overrides previous maps}}
|
|
|
|
}
|
2021-09-12 00:03:13 +00:00
|
|
|
```
|