merge_map 1.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 86

merge_map #

Combine multiple Maps into one. Equivalent to Object.assign in JS.

Example #

import "package:merge_map/merge_map.dart";

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}}
}

1.0.2 #

  • Add an example, for Pub's sake.

1.0.1 #

  • Add a specific constraint on Dart versions, to prevent Pub from rejecting all packages that depend on merge_map (the entire Angel framework).
  • Add generic type support

example/main.dart

import 'package:merge_map/merge_map.dart';

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]);
    print(merged);

    // {hello: world, foo: {bar: baz, john: doe, this: overrides previous maps}}
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  merge_map: ^1.0.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:merge_map/merge_map.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
73
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
86
Learn more about scoring.

We analyzed this package on Dec 9, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.13.1+4

Health suggestions

Fix lib/merge_map.dart. (-1 points)

Analysis of lib/merge_map.dart reported 2 hints:

line 28 col 20: Use = to separate a named parameter from its default value.

line 28 col 43: Use = to separate a named parameter from its default value.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <3.0.0
Dev dependencies
test any