newAttributeMap static method

Map<String, Attribute> newAttributeMap(
  1. Map<String, dynamic> m
)

Converts a map of simple strings or list values into a Map of Attribute.

var attrs = Attribute.newAttributeMap({
  'objectClass' : [ 'top', 'person', 'inetPerson' ],
  'sn': 'Smith',
  'cn': 'John Smith'
});

This is a convenience method to allow code using ordinary Dart Map and List to be used to represent attributes, instead of working with Set and LDAP Attribute objects.

Implementation

static Map<String, Attribute> newAttributeMap(Map<String, dynamic> m) {
  var newmap = <String, Attribute>{};
  m.forEach((k, v) {
    newmap[k] = (v is Attribute ? v : Attribute(k, v));
  });
  return newmap;
}